Skip to main content

Posts

Showing posts from July, 2020

Git Fundamentals and useful command to use

      Create Repo from GitHub site. Step 1. Create a local source control path Step 2. Got to Git Bash Step 3. initialize the git       Linked or remote origin $ git remote add origin " https://github.com/shubh1984/SampleProject.git "       Pull $ git pull origin master     Status $ git status     Adding file to local repo $ git Add file name $ git add -A      [add all]     Commit $ git commit filename -m "commit comment" $ git commit -a -m "commit comment"    [commit all]     Push to remote server $ git push  origin master $ git push -f origin master     Fetch [need to do merge]

Simple LRU Cache Implementation using C#

                  public class Node     {         public int Key, Value;         public Node Prev, Next;         public Node( int key, int value)         {             this .Key = key;             this .Value = value;         }     }       public class CustomDoubleLinkedList     {         Node Head;         Node Tail;         public CustomDoubleLinkedList()         {             this .Head = new Node(0, 0);             this .Tail = new Node(0, 0);             this .Head.Next = this .Tail;             this .Tail.Prev = this .Head;         }         public void AddToHead(Node currNode)         {             currNode.Prev = this .Head;             currNode.Next = this .Head.Next;             this .Head.Next.Prev = currNode;             this .Head.Next = currNode;         }           public void PromoteToHead(Node currNode)         {             RemoveNode(currNode);             AddToHead(currNode);