Monthly Archives: April 2017

Vectors in R

#Create the vector students <- c(‘Ashish’,’Manas’,’Puspendu’) print(students) #Print the class print(class(students)) Advertisements

Posted in R, Uncategorized | Leave a comment

How do you analyze Algorithm

There are 2 analysis that need to be done : (1)Priori Analysis which is the theoretical analysis of the algorithm. (2)Posterior Analysis:This is the empirical analysis .In this actual analysis like running time and space are calculated.

Posted in Algorithm | 1 Comment

Implement LinkedList Java

import org.testng.annotations.Test; class ListNode { public int val; public ListNode next; public ListNode(int x) { val = x; } } public class LinkedList { @Test public void testInsert() { ListNode l1=new ListNode(2) ; ListNode l2=new ListNode(1) ; ListNode l3=new ListNode(3) ; … Continue reading

Posted in Uncategorized | Leave a comment

Simple example using matplotlib

”’ Created on Apr 25, 2017 @author: asharda ”’ import matplotlib.pyplot as plt plt.plot([1,2,3,4]) plt.show()

Posted in Python, Uncategorized | Leave a comment

Add all elements of the array using numpy

”’ Created on Apr 23, 2017 Add all elements of the array and using Axis @author: asharda ”’ import numpy as np num=np.array([[1,2],[3,4]]) print(np.sum(num))#Print 10 print(np.sum(num,axis=0))#Print [4,6] print(np.sum(num,axis=1))#Print [3,7]

Posted in Python | Leave a comment

Matrix Add,Multiply and Subtract using Python

”’ Created on Apr 23, 2017 Matrix Addition,Multiplication and Division using Python Numpy @author: asharda ”’ import numpy as np x=np.array([[5,5],[5,5]],dtype=np.float64) y=np.array([[1,2],[3,4]],dtype=np.float64) print(“Sub”,x-y) print(“Multiply”,x*y) print(“Add”,x+y)   This assumes you already have numpy installed.

Posted in Data Structures, Python | Leave a comment

Stream API Java

@Test public void testStream() { List list=new ArrayList<Integer>(); for (int i=0;i<100;i++) { list.add(i); } list.stream().forEach(System.out::println); }

Posted in Java | Leave a comment