Data Structure and Algorithm

1 minute read

Data Structures

Different ways of storing data on the computer or more simple way is a database

Array

Collection of items in single type

array cant be changed, once it has defined, it cannot be changed. For example in Python it’s called tuple

tuple1 = (1,2,3)

tuple1 cannot be changed since it’s immutable, thus in order to change the tuple it must be converted to the list first and add another element to the list via append and change it back to tuple. Once a tuple is created, you cannot add items to it. Tuples are unchangeable. Example:

x = ("apple", "banana", "cherry")
y = list(x)
y[1] = "kiwi"
x = tuple(y)

thislist = ["apple", "banana", "cherry"]
thislist.append("orange")

Example:

thistuple = ("apple", "banana", "cherry")
thistuple[3] = "orange" # This will raise an error

Memory

a long tape of bytes (byte is a small unit of data consists of 8 bits) Ram - temporary memory Disk - permenant memory

Linked List

Built-in Data Structures

  • List
  • Dictionary
  • Set
  • Tuple

User-Defined Data Structures

  • Stack
  • Queue
  • Tree
  • Linked List
  • Graph
  • HashMap
  • many more (build mindmap using the data structures) https://www.youtube.com/watch?v=xOuRE3IuEB8

Algorithm

Operations on different data structures and sets of instructions for executing it or simplay way to define it is programming

Tags:

Updated: