Wednesday, November 10, 2010

Class 3 : 9-Nov

Blogged By : Divya Monisha D.P, Kavyashree

Summary of class dated Nov 9 2010


There was a general discussion on the kind of novels read by the students. Sir highlighted the need to read different kinds of books, Sir quoted “ its good to have reading habits” and then said “lets come to data structures”.

In this paper first step is to understand the Data Structure, able to to draw the node, Explain the inserts and delete in node in simple English to a novice and then and only then try to understand learn and memorize the algorithm

1. Stacks
Structure representation
struct node
{
int info;
struct node * next;
}

Diagram of a stack ? Try It

Methods of a stack
a. Push
b. Pop
c. Display

2. Linked list

Structure representation
struct node
{
int info;
struct node * next;
}

Methods of a linked list
a. Insert at begining
b. Insert at end
c.Insert at s postion.
d. Delete at begining
e. Delete at end
f. Delete at s postion.
g. Display

3. Doubly Linked list
Structure representation
struct node
{
int info;
struct node *prev;
struct node * next;
}

Methods of a doubly linked list are similar additionally
h. Display in Reverse

4. Binary Search Tree
Node of a binary search tree
Structure representation
struct bstnode
{
int info;
struct bstnode *left;
struct bstnode * right;
}

Structure representation using typedef
typedef struct bstnode
{
int info;
struct bstnode *left;
struct bstnode * right;
}NODE;

The NODE here alias name for struct bstnode, in a sense NODE can be used in the program
inseated of using struct bstnode.

Draw the bst for the following numbers
2 4 6 8 10 ? Is the tree lop sided

6 4 8 2 10 9 5 ? Is it balanced ? What is complete and nearly complete


No comments:

Post a Comment