Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
Advanced Data Structures 2005
1. Advanced Data Structures, 2005 Sanjay Goel, JIIT
Advanced Data Structures
Lecture Notes
1. 11.1.05 (2 hrs)
1. Discussion on Course Description and evaluative components.
2. Feedback collection on the impact of first DS course on software development skills.
3. Group exercise on Concept Map and Data Tank identification for implementing one of following
software packages:
i. Word Processor ( MS Word like)
ii. Internet Browser
iii. Photoshop
iv. Powerpoint
v. Flash
vi. Winamp
vii. Compiler (TC like)
4. Assignment : Refine you Concept Map and come prepared to make a presentation for the class.
2. 18.1.05 (2 hrs)
1. Consolidation of the feedback : Average Impact of DS 3.16 5.35.
2. Discussion on Relationship between DS, ADS, DBMS and OOPS.
3. Table as Data Structure
4. Review of Software Design and Development Process learnt in first course of DS
Software Design Process: Design story Concept Map of Problem Concept map of Solution (with simpler verbs
and new data tanks, if needed) data structures and detailed algorithms performance analysis (using time and
space complexity analysis techniques) program Software Testing and evaluation.
5. Relationship between ADT and Class.
6. Review of ADT and Data Structure Design process learnt in first course of DS
Detailed Process for 3rd stage i.e. Concept map of Solution (with simpler verbs and new data tanks, if needed) data
structures and detailed algorithms :
i. Detailed modeling of each data tank with examples and identification of fields.
ii. Structural abstraction of each Data Tank Abstract Data Type (ADT)
ii. ADT specification of public view of ADT in terms of list of permitted and required operations for
construction, destruction, manipulation and access. Have sufficient access functions to test the
preconditions and post conditions for for other operations.
iii. Interface design for each operation in terms of function name and parameters list and their description.
iv. Pre-conditions (in terms of access functions) for each operation. Refer 2002 DS lect 3_01 to 3_03.
v. Post conditions (in terms of access functions) for each operation.
vi. Case specific Data Structure for each ADT .
vii. Algorithm for each operation sub program (function) for each operation.
7. Presentation on the Concept map and Data Tanks for Photoshop.
8. Discussion about the Core Data tank for storing multilayered images.
9. In class exercise : Propose a Data Structure for *.psd files.
10. In class exercise : Propose a scheme for converting *.psd file into *.bmp files.
11. In class exercise : Propose schemes for simple photoshop operations like 90 degree rotation,
complement image.
2. Advanced Data Structures, 2005 Sanjay Goel, JIIT
12. Assignment : Re-examine Photoshop functionality and user interface from a software designer’s
perspective and propose appropriate data structures for it. Think about the scheme for
implementing other simple operations like cropping, erasing, stamping and so on.
13. Presentation on the Concept map and Data Tanks for Winamp.
14. Discussion about the Core Data tank.
15. Presentation on the Concept map and Data Tanks for Flash.
16. Discussion about the Core Data tank.
17. Some suggestions for identifying your first paper for your literature survey:
i. Select paper(s) that use one or more of the of the Data Structure already studied by you
(e.g. Table, Stack, Binary Tree, BST, Queue, Dequeue and so on) in the first course.
ii. Select paper(s) on ADT specification and design.
iii. Select paper(s) that describe the ADTs or classes used for designing a complete software
system of your choice.
iv. Select paper(s) that discuss recursive solution for some algorithmic problem.
v. Select paper(s) that recursion removal techniques.
vi. Select Paper(s) that discuss simulation models using queues.
3. 01.02.05 (2 hrs)
1. Visualise Tree as a set of nodes
2. Tree traversal algorithms can be used to access set-element in a specific order
3. Exercise: Binary Tree Construction from given traversal sequences
4. Questions: Can you reconstruct the binary tree from only one traversal sequence ?
5. Questions : Can you reconstruct the binary tree from two traversal sequence ?
6. Analysis of binary tree reconstruction power of traversal sequence using combinations of any two of
the following traversal sequences:
- Pre-order
- Post order
- In-order
- Level-order
7. In-order gives information about left sub-tree and right sub-tree, Pre/post/level order traversal
sequences give immediate access to next parent node.
8. Is it top-down or bottom-up tree construction?
9. Binary expression tree : leaves are operands, non-leaves are operators.
10. In class assignment: Can you reconstruct the binary expression tree from only one traversal
sequence?
11. Analysis of binary tree reconstruction power of traversal sequence using any one of the following
traversal sequences:
- Pre-order (infix)
- Post order (post fix)
- In-order (prefix)
12. Design of binary tree reconstruction algorithms using any two of the following traversal sequences:
- Pre-order (infix)
- Post order (post fix)
- In-order (prefix)
13. Is it top-down or bottom-up tree construction?
3. Advanced Data Structures, 2005 Sanjay Goel, JIIT
14. Model this tree construction process as
- Producer (infix/postfix/prefix expression sequences read from left to right or from right to
left),
- Buffer (to temporarily store the unprocessed and or semi-processed operands and sub-
expressions)
- Server (to combine operands and semi-processed sub-expression tree into larger sub
expression trees using new operator as parent.
15. Question : What is the nature of this buffer: Stack of pointers to binary expression trees
16. The whole process can be viewed as converting a forest into a single tree. Initially all operands and
operators are independent single node binary expression trees. Tree construction takes place in
bottom up manner.
17. BST tree is constructed using top-down contruction approach where parents get placed in the tree
before children.
18. Demonstration of design and simulation tool for digital circuits : Siddhartha Batra
19. Algorithm design Techniques:
a. Divide and Conquer : quicksort, factorial and so on
b. Iterative
c. Data producer, Buffer and Server
d. Greedy approach : Traveling salesman example , pick up the nearest city to the
current city and move rather than trying to find the overall best path choose the best
for the current best. May not give optimized solution but gives a solution in linear or
polynomial time.
20. Huffman encoding and decoding scheme.
21. Code lookup table as a binary tree
22. Algorithm for construction of binary tree for assigning Huffman codes to a symbol set: a Bottom up
binary tree construction.
23. Buffer is needed in Bottom up tree construction algorithms.
24. References : DSII 2002-03 lecture notes lecture # 14, 15, 16, 17
25. Assignment : Write Algorithms for constructing binary trees using traversal pairs of :
–Inorder and Preorder
–Inorder and Postorder
–Inorder and Level Order
26. Assignment : Assume binary trees in which each node carries a name. WAP that, when given the
root of a tree, writes the names of the nodes of the tree level-wise from bottom up, and in each level
from right to left. Your algorithm should be of time complexity O(n), where n denotes the number of
nodes in the trees.
27. Assignment : WAP for binary expression tree construction using prefix, infix and postfix expressions.
28. Assignment : WAP for compressing given text files using Huffman encoding scheme.
4. 08.02.05 (2 hrs)
1. Review of Huffman tree.
2. Review of applications of Buffer in algorithm design : if the input data stream is such that all or
some of the data items as per the input data stream can not be processed for output then an
appropriate buffer can be used to store the seen (arrived) but un-processed (or semi processed) data.
Consider the buffer for tree construction and also tree traversal.
4. Advanced Data Structures, 2005 Sanjay Goel, JIIT
3. BST algorithms and complexities Refer 2002 DSII lect 18, 19, 20): insert, find, findmin, findmax,
delete algorithms and their complexities.
4. Exercise: find the arrival order(s) of input sequence of 0-10 numbers that would cause a well
balanced and unbalanced BST tree to be constructed after repeated insertion of arriving data as nodes.
5. Comparison of BST with sorted array.
6. Decision trees : example of path finding.
7. Converting truth tables into decision trees.
8. Converting decision tables into decision tables.
9. Many problems are solved using some kind of search strategy : Game playing is often modeled as
searching of the correct next move.
10. There are several kinds of tree traversal techniques for searching the solution search.
11. Breadth First Search : Generalisation of level order traversal in n-ary trees. Rat in the maze, shortest
path, using queue as the buffer. It finds the shallowest solution.
12. Depth First Search : Generalization of pre-order and post-order traversal in n-ary trees. Rat in the
maze, tower of Hanoi and so on, using recursion of stack as the buffer.
13. There are many more search (using tree traversal) strategies for searching a set organized a trees.
5. 15.02.05 (2 hrs)
1. Announcement of Problem option for Minor I (Take home assignment).
2. Concept map (DS) Concept map (DBMS) ER Diagram
Class Diagram
3. Review of decision tree.
4. Decision tree as a representation of decision tables (generalization of truth tables when the variables
and decisions are not binary)
5. Truth tables can be represented as Binary decision diagrams. Algorithms can be used for
simplification of logic using these diagrams rather than truth table representation.
6. Problem solving is often a process of multi-step decision making with or without opponent. When
opponent exist, it is like game playing. What about the supporters ?
7. Modeling of Path finding, Rat in the Maze, Tower of Hanoi, Tic-tac-toe and chess as multi-step
decision making.
8. Decision space can be modeled as decision tree. Each choice (choosing a branch) has some
consequences in terms of limiting further choices (subtree).
9. Decision making can be modeled as searching for right node and path from root to that node.
Rightness is defined in terms of suitability to the purpose, often in terms of testing the goal condition.
Goal test in path finding is to test if the cell coordinates of the node match the desired coordinates of
the goal. Goal test for Tower of Hanoi is to test if all the discs are in right order on the destination
pole. Goal test for Tic-tac-toe or chess may be if it is a win situation for computer.
10. Decision trees are static or learning. AI systems often use learning decision trees.
11. Many search techniques exist for searching through the decision trees.
12. Explanation, application and evaluation of BFS, DFS, DLS, Min-Max, alpha-beta pruning search
strategies.
13. Assignment : Implement Rat in the Maze and Tower of Hanoi (without fancy graphics) without using
decision tree. Re-implement one of these using the notion of decision tree. Implement BFS and
alpha-beta pruning algorithms for a decision tree varying degree and depth. Empirically compare the
time and space complexity for
14. Reference: 2005 Lecture slides on decision tree.
5. Advanced Data Structures, 2005 Sanjay Goel, JIIT
6. 22.02.05 (2 hrs)
1. Problem Solving through Computation.
2. Problem solving is the process of logically constructing a solution to a problem.
3. In CS, we concentrate on solutions utilizing computing resources.
3. An important aspect is to be able to describe a method (plan/algorithm) to solve a problem without
solving a particular problem.
5.
Problem Formulation
Problem Analysis
Algorithm Design
Translate to Computer Program
Type the program
Verify the program
Gather data for
Solve the problem
6. Problem Formulation: To create a clear and concise statement of problem.
•Initial state (IS), Final state (FS)
•Plan is a sequence of activities from IS to FS.
•If these activities are finite and unambiguous : The plan is an algorithm
•Initial objects à Final objects. (through transformation or creation)
7. Problem Statement: Required Properties:
•Complete: Cite All aspects of IS and FS and include all important objects and constraints
•Precise: Use unambiguous language
•Consistent: with nature and between IS and FS
•General: scope should cover a wide range of situations.
8. Problem Analysis: Use Problem statement to identify the objects and actions of the problem.
•In Objects {objects (data tanks) in the IS, needed before the algorithm starts},
•Out Objects {objects (data tanks) in FS, wanted at the end of algorithm}.
•State facts like generic names, range, assertions, units, magnitude, special cases about each object.
•Identify Important variable (that vary between IS and FS)
•List the important actions (activities, processes and operations) that are needed to transform and
transfer the objects from from IS to FS.
•List special circumstances: exception handler.
•List assumptions like constraints and tolerance
6. Advanced Data Structures, 2005 Sanjay Goel, JIIT
•Create mathematical model, if possible.
9. Integrate this process with current technique of concept mapping. Refer Lecture notes DS, 2004 for
the current notation details.
i. Develop Initial State Diagram (ISD) as a collection of IN Data tanks.
ii. Develop Final State Diagram (FSD) as a collection of OUT Data tanks.
iii. Develop Concept map (CM) as a network of all Data tanks (IN, OUT + temporary data
tanks) and Processing Units.
a. Enhance the current notation of Concept maps to increase its communication power
by putting following symbols on the center of the top line of the Rectangular box of
Tank.
i. IN Data Tanks :
ii. OUT data tanks :
iii. IN & OUT Data tanks:
iv. Temporary buffer type data tanks: No symbol.
b. Ensure consistency across ISD, FSD and CM
10. Form evolves to support functionality : Data structure evolves to support added functionality and/or
to enhance efficiency of certain operations without causing much (ideally no) damage to the
efficiency of other operations.
11. A constraint on Binary tree modifies its form to BST and gives efficiency of search without much
slow down of Insertion and deletion.
12. Indexed Binary Search Tree (IBST) evolves to support efficient index search in data set, in addition
to supporting the other operations at the efficiency level of BST. Search algorithm for IBST.
Complexity analysis
13. Refer : DSII 2002 Lect 21.
7. 1.03.05 (2 hrs)
1. IBST : Algorithms for insertion, deletion, modification of non-key field, modification of key field,
print in ascending order, print in descending order, successor, predecessor. Complexity analysis.
2. Threaded Binary Search Tree (TBST) : Algorithms for search, insertion, deletion, modification of
non-key field, modification of key field, print in ascending order, print in descending order,
successor, predecessor. Complexity analysis. Refer : DSII 2002 Lect 22, Lect 23
3. Group Assignment (3 students): Create, access and manipulate and analyse the performance of
Indexed Data file with following fields:
i. Roll No (Key)
ii. Name
iii. Address
iv. CGPA
v. Hobbies
7. Advanced Data Structures, 2005 Sanjay Goel, JIIT
a. WAP to create a data file of records with above fields in *.txt format. Roll No is unique.
Records and Each field are to be separated by appropriate delimiters.
b. Wap to create and maintain an overarching index structure for this data file as Threaded
Indexed BST (TIBST) of nodes with key field of ‘Roll No’ and also having the record
number of the relevant record in the data file. While saving the file, the index structure
should also be saved as a file which should simultaneously open up in memory as a RAM
based TIBST with opening of the data file.
c. Analyse the performance of this indexed storage structure theoretically and also
experimentally for different data size of 100 record, 1000 records and 10000 records with
respect to following operations:
i. Search on key,
ii. Search on index,
iii. Search on non-key,
iv. Insertion,
v. Deletion,
vi. Modification of non-key field,
vii. Modification of key field,
viii. Display in ascending order,
ix. Display in descending order,
x. Display successor and
xi. Display predecessor operations.
d. On the above operations, compare the performance (Time and space) of your indexed file
with the performance of MS Access using SQL by importing the same data file into MS
Access.
8. 15.03.05 (2 hrs)
1. Review of key ideas.
- DS design for Algorithm design
- Inductive thinking for algorithm design
2. AVL Tree : DS and Balancing algorithm. Refer : DSII 2002 Lect 23-24 to Lect 27
9. 29.03.05 (2 hrs)
1. Review of Algorithmic problem solving, Algorithmic thinking and algorithm design process.
2. Assignment :
i. Write your process.
ii. Compare your process with three more students in your class and refine your process.
Interview at least one senior student (3rd year or 4th year) or a working engineer to learn about
his/her process and further refine your process with these inputs.
iii. Submit a copy of your final statement before 5th April through email sanjay.goel@jiit.ac.in.
iv. Use your refined process to solve the problems given in Minor II.
v. Write programs to implement the algorithms.
8. Advanced Data Structures, 2005 Sanjay Goel, JIIT
4. Fibonacci Tree, Binomial tree. Refer : DSII 2002 Lect 28.
5. Assignment : Use your refined Algorithm design process developed in above assignment and WAP
to test if a binary tree is an AVL tree or more specifically a Fibonacci tree or not.
6. Multiway search trees Refer : DSII 2002 Lect 29.
7. Assignment : Use your refined Algorithm design process developed in above assignment and WAP
to test if an n-ary tree is a Binomial tree or not.
Note : Please do not copy, by sincerely doing these assignments, you have a chance to identify and
remove the gaps in your process.
10. 5.04.05 (2 hrs)
1. Multiway search Tree: Data Structure, Search and insertion algorithms, comparison with BST.
2. B Tree : Data Structure, Constraints, insertion process; balancing goal, Blocking factor. Refer :
DSII 2002 Lect 29 and 30.
11. 12.04.05 (2 hrs)
1. B Tree, B+ Tree, B* Tree, Refer : DSII 2002 Lect 31-32.
12. 19.04.05 (2 hrs)
1. Trie.
2. Single ended priority Queue (operation: Insert and one of the remove-min or remove-max) , Heap,
Heap sort, skip list Refer : DSII 2002 Lect 31-32, Lect 33.
2. Assignment : WAP to read words from a file and store them in a Trie structure.
3. Review of Apriori Analysis, Posterior Analysis.
4. Review of Algorithm design techniques:
i. Brute Force : e.g. Linear search, selection sort, Bubble sort.
ii. Decrease and Conquer : e.g. insertion sort
iii. Divide and Conquer : Recursive problem solving e.g. Quick-sort, Recursive Merge-sort,
Tower of Hanoi,
iv. Dynamic Programming : Non-recursive bottom-up merge sort, Fibonacci series,
Binomial coefficient.
v. Greedy Algorithm : e.g. Huffman coding.
vi. Backtracking : e.g. Rat in the maze, DFS, game
vii. Randomised Algorithms : when a random number is generated to take some decision
during processing, e.g. Quick sort with randomly chosen pivot element.
5. Assignment : Revise Graph related literature studied by you in Discrete maths.
13. 26.04.05 (2 hrs)
1. Application of Graph as a representational structure of real life entities like:
- Circuits
- Roadmaps
- Concept maps, ER-Diagram
- State Transition Diagram, Cycles, Processes
9. Advanced Data Structures, 2005 Sanjay Goel, JIIT
- Assemblies (Human anatomy, map of India, bicycle, computer, computer network and so on).
2. Possible computational operations that are required for each of the above case.
- insert node (k1)
- delete node (k1)
- insert edge (k1,k2,edge_wt/edge_label)
- delete edge (k1,k2,edge_wt/edge_label)
- list_neighbour nodes (k1)
- adjacent_districts (Gautam Budh Nagar)
- path (k1,k2)
- shortest_path(k1,k2)
- next_state(si, ej)
- what_events (si, sj)
3. Data structure for storing undirected graph, directed and multi-edge graphs using, Adjacency Matrix
and Adjacency Lists. Refer DSII 2002 Lect 33.
4. Operations on graphs, complexity of operations, use of Look up table that may be implemented using
array, sorted array, BST, AVL, m way search tree, Trie, Btree or some other structure.
5. Optional Assignment : Represent maze (of rat in the maze problem) as a graph and reformulate maze
traversal algorithms (recursive, using stack, using queue) with new representation.
14. 03.05.05 (2 hrs)
1. Examples of Greedy Algorithms: On the model of Producer-Buffer-Server. Buffer can be Stack/
FIFO Queue / Priority Queue or even a Set.
2. DFS (recursively or using a stack buffer) and BFS (using (FIFO queue buffer) traversal of Graph
from a source node to destination node.
3. Unweighted graph : Minimum Spanning Tree, extension of DFS and BFS. Refer DSII 2002 Lect 34.
4. Weighted Graph : Minimum Spanning Tree Algorithms.
5. 2 broad class of algorithms Through Edge-rejection Vs Edge-selection.
6. Through Edge-rejection.: 2 strategies
6.1 Pick up the costliest edge and check if it is on a cycle, if it is remove it. Iterate through this process
till cycle remain in the graph.
6.2 Pick up cycles iteratively and remove costliest edges from each cycle.
7. Through Edge-selection.: 4 strategies
7.1 Kruskel Algorithm: Start with the forest of all nodes, add cheapest link to the growing connected
graph. Iterate through the process of adding more edges (cheapest out of the un-selected) such that it
does not add a cycle.
7.2 Prim’s Algorithm: Start with node, pick up the connected node through its cheapest link. Iterate
through this process by selecting new nodes that connected to the growing graph through the cheapest
link (cheapest out of the un-selected), by avoiding to add links that create cycles.
7.3 Sollin’s Algorithm: Start with the forest of single nodes. Transform this to the forest of connected
components such as the connected components are created through the cheapest links. Iterate through
the process such that no cycles are added.
7.4 Dijkastra’s Algorithm: Start with a node and add new nodes. Use the buffer based on a Priority
Queue based on the estimated distance of the nodes from the growing connected graph. Re-estimate
the distances of unselected nodes because of new confirmations.