,LECTURE 1 :
Introduction
Random Access Machine ( RAM)
In the RAM model of computation ,
it is assumed that the CPU
has and that primitive take constant
some
memory operations a
amount of time .
Data structure : a structure to store and
organize data in the
memory in order to facilitate access and modifications
Algorithm : an
unambiguous way for doing a task , which takes
input and output ( finishes the task)
an produces an .
A
primary goal of designing data structures is to speed up
algorithms If the data is not well
organized in the
.
memory ,
it will take to
longer for the
algorithm be completed .
,Arrays and Linked Lists
Array :
represents a contagious portion of the
memory
:
all
elements in stored next in the
an
array are to each other
memory
Advantages :
very quick to
get an access to an element of
an
array , by knowing the index of the element .
insert I delete
Disadvantages : Hard to items into the
array , as
need place to all the elements to make
you a move
place or to move them back .
linked lists
Singly
-
Elements are stored in
arbitrary places in the
memory
and point
they to each other
A node in a list contains :
I , a data element V - data
2. a pointer v. next to the next node of the list
in the last node of the list ,
the
pointer is None or
nveeptr
Insert nodes
, Removing nodes
Doubly linked lists
A contains :
node v in a
doubly linked list
-
I .
a data element v. data
2. a pointer v. next to the next node in the list
3. a pointer v .
prev to the previous node in the list
Inserting a node
Introduction
Random Access Machine ( RAM)
In the RAM model of computation ,
it is assumed that the CPU
has and that primitive take constant
some
memory operations a
amount of time .
Data structure : a structure to store and
organize data in the
memory in order to facilitate access and modifications
Algorithm : an
unambiguous way for doing a task , which takes
input and output ( finishes the task)
an produces an .
A
primary goal of designing data structures is to speed up
algorithms If the data is not well
organized in the
.
memory ,
it will take to
longer for the
algorithm be completed .
,Arrays and Linked Lists
Array :
represents a contagious portion of the
memory
:
all
elements in stored next in the
an
array are to each other
memory
Advantages :
very quick to
get an access to an element of
an
array , by knowing the index of the element .
insert I delete
Disadvantages : Hard to items into the
array , as
need place to all the elements to make
you a move
place or to move them back .
linked lists
Singly
-
Elements are stored in
arbitrary places in the
memory
and point
they to each other
A node in a list contains :
I , a data element V - data
2. a pointer v. next to the next node of the list
in the last node of the list ,
the
pointer is None or
nveeptr
Insert nodes
, Removing nodes
Doubly linked lists
A contains :
node v in a
doubly linked list
-
I .
a data element v. data
2. a pointer v. next to the next node in the list
3. a pointer v .
prev to the previous node in the list
Inserting a node