Posts

Showing posts from March, 2020

Mid - Sem 2 - Summary

Linked List Linked List is a linear data structure, list of elements are stored randomly at a contagious memory location. Which the elements are accessible using pointers. Unlike array, data's are stored linearly or side by side in a memory and size of memory are limited. A Linked List consist of node, we can insert data inside the node. The node also consist of a 'next' pointer which will point to the next node in the linked list. This next pointer are what connects the linked list together. We also have 'head' this is to mark the beginning or the first node. we can also use 'tail' to mark the last node. The last node will not point anything or pointer a 'NULL'. There are 2 ways of linked list, namely, single linked list and doubly linked list. In doubly linked list, the only different is that, they have a 'prev' pointer. This pointer is use to point the previous node in the linked list. A linked list has a couple important functi...

Hash Tables and Binary Tree

Image
Hashing and Hash Tables Hashing Hashing is the transformation of a string of characters into a shorter length value or key that represents the original string. Hashing is used to index and retrieve items in a database because it is faster to find item using the shorter hashed key than to find it using the original value. such function is called hash function which come with different forms and each will gives different result. for example you have a input of integers such as "11", "12", "13", "14" and we place them in an array. List = [11, 12, 13, 14] If we want to find the number "14" it will take time complexity of O(n). What if we have a huge amount of data stored, it will be to long to find a specific number. but with hashing and hash table with will only took time complexity of O(1).  Let the hash function H(x) maps the value X at the index in x%10 in an array. It will be shown: The same happen if the ...