GoConqr has a new look! Let us know what you think.

Mind map

Four Basic Data Structures

Jovain Sterling Computer Science English

Map content

Four Basic Data Structures

  1. Lists

    • [...,...,...]
      • myList = ["lemon", "banana", True, 2, 12]
        • includes Strings, boolean, and integers
        • there are 4 indexes: 0,1,2,3
    • appendable/changeable
      • Add or Remove elements from the list
        • myList.append
        • myLIst.remove("lemon")
  2. Dictionaries

    • key:value
      • carOnSale = { "brand": "Toyoya", "model": "Corolla", "year": 2018, "sold": True
      • access elements
        • print(carOnSale)
        • carOnSale["color"] = "silver"
        • theBrand = carOnSale["brand"]
    • describe items; used to store data
  3. Tuples

    • unchangeable
      • cannot add or remove elements
    • myTuple = ("meow", 32, False, "silly")
      • (...,...,...)
  4. Sets

    • unordered and rejects duplicates
      • to check if an element exists
        • Loop:
          • for x in mySet: print(x)
        • True or False
          • print("banana" in mySet
    • {...,...,...}
      • mySet = {"lemon", "banana", False, 2}
    • add elements
      • mySet.add("apple")
    • merge to Sets
      • mySet.update(newSet)
  5. ordered and allows duplicates (both Tuples and Lists)

    • to access an element
      • item = myList[2]
    • to access an element
      • item= myTuple[1]
        • returns "32"
      • myTuple[-1]
        • returns last item "False"
      • myTuple[1:3]
        • returns index 1 AND 2 AND 3 32, False, "silly"

Information

Description
Computer Science Mind Map on Four Basic Data Structures, created by Jovain Sterling on 19/09/2021.
Created by
Jovain Sterling
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?