Posts

Showing posts from June, 2019

All data structure codes using java

Image
I had cerated this github repo . In this repo i have covered nearly every topic which is essential in Data-Structure .  THE LIST IS HERE : 1.  data_structure/sorting  2.  hash table 3.  linked list 4. stack 5. queue 6. heaps 7. sets 8 Tree  9. Vectors Download source code for all datastructure in java Direct download zip files of Data Structure using java repository  following are screenshots of repo what it will contain : I really hope here you will find all neccessary codes for data structure and will be to understand . you can also add a read me for my repository . @Mazerunner

Stack - data structure using java(part-3)

! . first created first basic Employee class. package stacks; public class Employee { String firstname; String lastname; int id; public Employee(String firstname, String lastname, int id) { super(); this.firstname = firstname; this.lastname = lastname; this.id = id; } /** * @return the firstname */ public String getFirstname() { return firstname; } /** * @param firstname the firstname to set */ public void setFirstname(String firstname) { this.firstname = firstname; } /** * @return the lastname */ public String getLastname() { return lastname; } /** * @param lastname the lastname to set */ public void setLastname(String lastname) { this.lastname = lastname; } /** * @return the id */ public int getId() { return id; } /** * @param id the id to set */ public void setId(int id) { this.id = id; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override p

Lnked lists-data structure using java(part-2)

step 1 : at first we have to create this "Employeelinkedlist" class for performing actions on linked lists .you can use any normal datatype also instead of using this specific class . package linked_list; public class Employeelinkedlist { private Employeenode head; private Employeenode tail; public void addtofront(Employee_1 employee) { Employeenode node = new Employeenode(employee); node.setNext( head); if(head== null) { tail = node; } else { head.setPrev(node); } head = node; } public void printlist() { Employeenode current = head; System.out.print("Head ->"); while(current != null) { System.out.print(current); System.out.print("<->"); current=current.getNext(); } System.out.println("null"); } } STEP 2 :- create "Employeenode" class for employees . package linked_list; public class Employeenode { private Employee_1 employee; private Employeenode next

Sorting :data structure using java (part-1)

This will be a series of 4-5 for data structure including codes with demonstration . this is very first for sorting . follow for more and see more blogs on django ; mongodb : hackerrank solutions etc. 1 . BUBBLE SORT :-- The most initial and basic sorting algorithm is bubble sort . We just compare left element of array to right element of array and swap it as per our need of ,as we want to arrange array in ascending or Descending order .  package sorting; import java.util.*; import java.io.*; public class Bubble_sort { public static void main(String[] args) { Scanner sn = new Scanner(System.in); int array [] = new int [5]; for(int i=0 ; i<5;i++) { array[i] =  sn.nextInt(); } for(int i=0 ; i<5;i++) { for(int j=i+1;j<5;j++) { if(array[i]>array[j]) { int temp = array[i]; array[i] = array[j]; array[j] = temp; } } } for(int k=0;k<5;k++) { System.out.println(array[k

MONGODB - a nosql database

Image
Before we start with mongodb , we have to know first why we need it ? We always use a SQL( structured query language) for database operations . Every thing in such databa ses is in tabular form. So if you have unknown set of data then how are you going to deal with it . The most easy way is to use a unstructured language. mongobd gives us such support. It takes data in JSON format and do its operations on it . No tables, no queries, no predefined format , not any need of known structure of data. So mongodb is most preferrable way to create your database and it is also faster .We will understand steps in its creation as following -- Databases: In MongoDB, databases hold collections of documents. To select a database to use, in the  mongo  shell, issue the  use   <db>  statement, as in the following example: copy copied use myDB Create a Database If a database does not exist, MongoDB creates the database when you first store data for that datab

DJANGO- a web framework of python(part-3) final blog of this series

Image
first blog of the series is here :  https://codexmaze.blogspot.com/2019/05/django-web-frame-work-of-python.html     As we all know that django has a set pattern of design. That is the reason it is more effective and most used now a days .This is going to be a short blog . in this blog i am going to introduce set pattern of Django in initial phases. STEP 1: CREATE A PROJECT  - - open powershell and type command   :                                "   python django-admin startproject projectname" STEP 2: CREATE AN APP - I already declared the difference betwen apps and projects in first part of this series . For starting an app inside a project type command :          AT first go under the same directory as of your project --                               $ cd c://user/desktop/projectname           Now start an app --                     $ python manage.py startapp appname now you will get an directory with appname with some predefined an organis

DJANGO-a web framework (REST API) part-2

Image
The REST  api (representational state transfer) in django basically gives a common architecture for every platform.It means that if you want to run your web application run on android , windows ,IOS or at any other place then rest is a common API. Now a days in any startup, company firstly implements REST api. Requirements : REST framework requires the following: Python (2.7, 3.4, 3.5, 3.6, 3.7) Django (1.11, 2.0, 2.1, 2.2) We  highly recommend  and only officially support the latest patch release of each Python and Django series. Installation : Install using  pip , including any optional packages you want... pip install djangorestframework pip install markdown # Markdown support for the browsable API. pip install django - filter # Filtering support ...or clone the project from github. git clone https : //github.com/encode/django-rest-framework Add  'rest_framework'  to your  INSTALLED_APPS  setting. INSTALLED_APPS = ( ... 'rest_f