Академический Документы
Профессиональный Документы
Культура Документы
Lecture By
Dr. V. Srinivasa Rao
M. Tech . Ph .D
1
Organization of Data Structures
2
Objective of Data Structures is a
ways of efficiently organizing and
manipulating data in main memory.
3
4
Applications
• backtrack searching
7
DEFINITION
(or)
Execution of a program on a computer requires data
that is stored at memory locations. It is often
useful to arrange these locations in a
convenient manner. Such arrangement is called a
data structure.
8
The Data Structures are primarily of two types
9
Abstract vs. concrete data structures
11
Some Stack Applications
• Implementing recursive call
• Expression evaluation
– Infix to postfix
– Postfix evaluation
• Maze problem
• Breadth First Search
12
an application of stack: stack frame of function call
local variables
fp old frame pointer
13
Applications of Stacks
• Direct applications
– Page-visited history in a Web browser
– Undo sequence in a text editor
– Chain of method calls in the Java Virtual Machine
– Validate XML
• Indirect applications
– Auxiliary data structure for algorithms
– Component of other data structures
14
Problems that Use Stacks
The runtime stack used by a
process (running program)
to keep track of methods in
progress
Search problems
Undo, redo, back, forward
15
Method Stack in the JVM
• The Java Virtual Machine (JVM) main() {
keeps track of the chain of active
int i = 5;
methods with a stack
foo(i); bar
• When a method is called, the JVM
} PC = 1
pushes on the stack a frame
m=6
containing foo(int j) {
– Local variables and return value int k; foo
– Program counter, keeping track of
the statement being executed
k = j+1; PC = 3
bar(k); j=5
• When a method ends, its frame is k=6
popped from the stack and control }
is passed to the method on top of bar(int m) { main
the stack … PC = 2
• Allows for recursion } i=5
16