/C-Programming

Code for different C programs from different topics in C

Primary LanguageC

C-Programming

Here you can find different C programs from different topics in C Programming

  • Linked List in C

  • Stacks in C

    • A Stack is a data structure which is used to store data in a particular order. Two operations that can be performed on a Stack are: Push operation which inserts an element into the stack. Pop operation which removes the last element that was added into the stack. It follows Last In First Out(LIFO) Order.
    • A stack overflow is an undesirable condition in which the program tries to use more memory space than the call stack has available. If a Stack is empty and yet a Pop operation is attempted, then it results in Stack Underflow condition.
    • Examples and Code:
  • Queues in C

    • In computer science, a queue is a particular kind of abstract data type or collection in which the entities in the collection are kept in order and the principle (or only) operations on the collection are the addition of entities to the rear terminal position, known as enqueue, and removal of entities from the front terminal position, known as dequeue. This makes the queue a First-In-First-Out (FIFO) data structure.
    • In a FIFO data structure, the first element added to the queue will be the first one to be removed. This is equivalent to the requirement that once a new element is added, all elements that were added before have to be removed before the new element can be removed.
    • Often a peek or front operation is also entered, returning the value of the front element without dequeuing it. A queue is an example of a linear data structure, or more abstractly a sequential collection.
    • Examples and Code:
  • Hash Tables or Hashing in C

    • Hash Table is a data structure which stores data in an associative manner. In hash table, the data is stored in an array format where each data value has its own unique index value. Access of data becomes very fast, if we know the index of the desired data.
    • One advantage of hashing is that no extra space is required to store the index as in the case of other data structures. In addition, a hash table provides fast data access and an added advantage of rapid update.
    • On the other hand, the primary drawback of using the hashing technique for inserting and retrieving data values is that it usually lacks locality adn sequential retrieval by key. This makes insertion and retrieval of data values even more random.
    • Collisions can occur when the hash function maps two different keys to the same location. The Two most popular methods are: