Posts

Showing posts with the label Data Structure

The Ultimate List Of Educational Websites

Image
Deviations from traditional learning models are often met with resistance, while introducing new technologies or methods often rely on systemic change. Despite challenges, online learning is making tremendous progress when it comes to infiltrating all pillars of education, from corporate learning to higher education, to K-12 schooling. Leaders in these spaces have discovered some significant ways in which online learning is better than in-person learning, and as a result, we’re seeing widespread implementation of connected technology to drive education initiatives. COURSES 1.  Udacity 2.  Coursera 3.  Ureddit 4.  EDX PROGRAMMING 1.  TreeHouse 2.  Code Academy 3.  Learn Code 4.  HTML Dog 5.  Try Python 6.  Ruby Monk 7.  Coding Bat LANGUAGE LEARNING 1.  Duolingo 2.  Memrise 3.  VerbLing VIDEOS 1.  Khan Academy 2.  Academic Earth 3.  Unplug The Tv M...

Reversal Of Linked List

Reversal Of Linked List:- Single Linked List- void reverse(struct node *start) {      struct node *temp,*ptr;      temp=start;      start=Null;      while(temp!=Null)      {           ptr=temp->next;           temp->next=start;           start=temp;           temp=ptr;      } } Circular Linked List- void reverse(struct node *start) {      struct node *temp,*ptr,*first;      temp=start;      first=start;      start=Null;      while(temp!=Null)      {           ptr=temp->next;           temp->next=start;           start=temp;           temp=ptr; ...

Insertion In Linked List

Single Linked List At Begening  void insert(struct node *start , int key) {         struct node *temp,*ptr;          temp = start;         if(temp==NULL)                 printf("Linked List is Empty");         else         {                 ptr= (struct node*)malloc(sizeof(node));                   ptr->data=key;                 ptr->next=temp;                 start=ptr;          } } At End void insert(struct node *start , int key) {         struct node *temp,*ptr;          temp = start;         if(temp==NULL)       ...

Sorting

Image
Selection Sort The smallest element is selected from the unsorted array and swapped with the leftmost element, and that element becomes a part of the sorted array. This process continues moving unsorted array boundary by one element to the right. Algorithm Step 1 − Set MIN to location 0 Step 2 − Search the minimum element in the list Step 3 − Swap with value at location MIN Step 4 − Increment MIN to point to next element Step 5 − Repeat until list is sorted Insertion Sort The array is searched sequentially and unsorted items are moved and inserted into the sorted sub-list (in the same array). This algorithm is not suitable for large data sets as its average and worst case complexity are of Ο(n 2 ), where  n  is the number of items. Algorithm Step 1 − If it is the first element, it is already sorted. return 1; Step 2 − Pick next element Step 3 − Compare with all elements in the sorted sub-list Step 4 − Shift all the elements in the sorted su...

Linked List

Image
Linked List A linked list is a set of node where each node has two field data field and address field, where data field contains the information and the address field stores the address of next node.          Linked list is a linear data structure. It uses non-contigous memory allocation scheme . Further we say linked list is a collection of node which uses non-contigous memory. The address field of any node in linked list which consist of "NULL" indicates end of linked list.          Linked list uses dynamic memory allocation which allows your program to obtain more memory space while running, or to release it if it is not required. For dynamic memory allocation we use these functions in C :- 1- Malloc() The name stands for memory allocation. This function reserves a block of memory of specified size and returns a pointer of type (void) which can be casted into pointer of any type. Syntax- ptr = (cast_type*)malloc(Byte_s...

Tower Of Hanoi

Image
Tower Of Hanoi Tower of Hanoi is a mathematical puzzle where we have three rods and n disks. The objective of the puzzle is to move the entire stack to another rod, obeying the following simple rules: 1) Only one disk can be moved at a time. 2) Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack i.e. a disk can only be moved if it is the uppermost disk on a stack. 3) No disk may be placed on top of a smaller disk The solution may be stated as:- 1- Move top n-1 disks from A to B using C as an auxiliary. 2- Move the remaining disks from A to C. 3- Move n-1 disks from B to C using A as an auxiliary. C code of Tower Of Hanoi. #include <stdio.h> int main() {     int a[]={ 5 , 4 , 3 , 2 , 1 },b[ 5 ],c[ 5 ],aa= 5 ,bb= 0 ,cc= 0 ,i= 0 ,k= 0 ,j= 0 ,count= 0 ,g= 1 ,aaa= 1 ,bbb= 0 ,ccc= 0 ;     char d,s;     printf( "A : 5 4 3 2 1\nB :\nC :" );     while (k!= ...