Skip to content

Instantly share code, notes, and snippets.

View dineshrajpurohit's full-sized avatar

Dinesh Purohit dineshrajpurohit

View GitHub Profile
@dineshrajpurohit
dineshrajpurohit / singlyLinkedList.js
Last active December 29, 2015 13:59
Javascript implementation of Singly Linked List (basic)
/****************************************************************
* Singly Linked list implementation (Node as Objects) using javascript
*
* - Dins
*****************************************************************/
// Global Object DS - Data Structure
var DS = {};
@dineshrajpurohit
dineshrajpurohit / SinglyLinkedList.java
Last active October 5, 2023 02:23
Basic Singly Linked List implementation in Java
/**
* Singly Linked list implementation in Java
*
* Copy the 3 classes in Node.java, LinkedList.java and Main.java in order to run the implementation
*
* Dinesh
*
* ____________ _____________ ______________
* |item "test1"| | item "test2"| | item "test3" |
* | next |-------->| next |----->| next |------>null
@dineshrajpurohit
dineshrajpurohit / DoublyLinkedList.java
Last active August 29, 2015 14:05
Doubly Linked List written in Java
/**
* Singly Linked list implementation in Java
*
* Copy the 3 classes in DList.java, DLinkedList.java and Main.java in order to run the implementation
*
* Dinesh
*
* ____________ _____________ ______________
* |item "test1"| | item "test2"| | item "test3" |
* | next |-------->| next |----->| next |------>null
@dineshrajpurohit
dineshrajpurohit / DoublyLinkedList.js
Last active August 29, 2015 14:05
Doubly Linked list implementation using Javascript
/**
* Javascript implementation of Doubly Linked list
*
* Dinesh
*
* (More to come) (Add more error handling scenarios)
*/
// Global object (namespace)
DS = {};
@dineshrajpurohit
dineshrajpurohit / StackList.js
Last active August 29, 2015 14:05
Stack implementation using Linked list in Javascript
/**
* Implementation of Stacks using Linked List
*
* Dinesh
*
*/
// Namespace
var EX = {};
@dineshrajpurohit
dineshrajpurohit / PostFix.js
Last active August 29, 2015 14:05
Executing Postfix expression implementation using Javascript
/**
*
* Postfix implementation using StackList:
* Code for stacklist: https://gist.github.com/dineshrajpurohit/0bb67d29a039f85f2f10
*
* Dinesh
*
* PostFix Expression parsing and getting the result
*
* e.g: 42+351-*+ ==> 18
@dineshrajpurohit
dineshrajpurohit / InfixToPostfix.js
Created August 16, 2014 06:45
Infix to Postfix conversion using Javascript
/**
* Infix to postfix implementation
*
* Dinesh
*
* Input: 4+8*6-5/3-2*2+2 ==> 486*+53/-22*-2+
*
* Algorithm:
* - Whenever an integer/character comes from expression we append to postfix String
* - Whenever a operator comes in we check the precedence of the incoming operator with the
@dineshrajpurohit
dineshrajpurohit / RootedTreeTraversals.java
Last active October 29, 2018 15:35
Preorder, Postorder,Inorder and Levelorder traversal of rooted trees using Java
/**
*
* Dinesh
*
* RootedTreeTraversal
* - Preorder Traversal
* - Postorder Traversal
* - Inorder Traversal
* - Levelorder Traversal
*
@dineshrajpurohit
dineshrajpurohit / RootedTreeTraversal.js
Last active September 27, 2018 05:38
Preorder, Postorder,Inorder and Levelorder traversal of rooted trees using Javascript
/**
*
* Dinesh
*
* RootedTreeTraversal
* - Preorder Traversal
* - Postorder Traversal
* - Inorder Traversal
* - Levelorder Traversal
*
@dineshrajpurohit
dineshrajpurohit / NumberAndRomanMain.java
Last active August 29, 2015 14:05
Number to Roman Conversion and Roman to Number conversion
package com.dinesh.tutorials;
class NumberAndRoman{
/**
* Converting the Numbers to Roman Numbers
*
**/
public static String convertToRoman(int num){
String rom = "";