Skip to content
{{ message }}

Instantly share code, notes, and snippets.

🎯
Focusing

# Gopesh Neptune998

🎯
Focusing
Created Aug 15, 2020
View cmd_line_input.sh
 Read name echo \$name
Last active Aug 14, 2020
View sample_class.py
 class Website: def __init__(self, name, url): self.name = name self.url = url def print_url(self): print("Name of Website " + self.name + "and URL "+ self.url) web1 = Website("NeptuneWorld", "https://neptuneworld.in/") web1.print_url()
Last active Aug 13, 2020
Insertion Recursive Algorithm
View insertion_recursive_algo.py
 # Insertion Recursive Algorithm function insertionSortR(array A, int n) if n > 0 insertionSortR(A, n-1) x ← A[n] j ← n-1 while j >= 0 and A[j] > x A[j+1] ← A[j] j ← j-1 end while
Created Aug 13, 2020
Insertion Sort Algorithm2
View insertion_algo2.py
 # Insertion Sort Algorithm2 i ← 1 while i < length(A) x ← A[i] j ← i - 1 while j >= 0 and A[j] > x A[j+1] ← A[j] j ← j - 1 end while A[j+1] ← x
Created Aug 13, 2020
Insertion Sort Algorithm
View insertion_algo.py
 # Insertion Sort Algorithm i ← 1 while i < length(A) j ← i while j > 0 and A[j-1] > A[j] swap A[j] and A[j-1] j ← j - 1 end while i ← i + 1 end while
Last active Aug 13, 2020
Insertion Sort
View insertion_sort.py
 # Insertion sort def Insertion_sort(arr, itr): lgth = len(arr) for i in range(1,lgth): x,j = arr[i],i-1 while j>=0 and arr[j]>x: arr[j+1] = arr[j] j-=1 arr[j+1] = x print("Iteration:",i,arr)
Created Aug 12, 2020
View Bubble_sort.py
 # Bubble sort def bubble_sort(arr, itr): lgth = len(arr) for i in range(lgth): for j in range(lgth-i-1): if arr[j]>arr[j+1]: arr[j],arr[j+1] = arr[j+1],arr[j] print("Iteration:",i,arr) itr+=1
Created Aug 9, 2020
View Polygon_class.js
 /* * Implement a Polygon class with the following properties: * 1. A constructor that takes an array of integer side lengths. * 2. A 'perimeter' method that returns the sum of the Polygon's side lengths. */ class Polygon { constructor(sides) { this.sides = sides; }
Last active Aug 8, 2020
View class_rectangle_extend_square.js
 // Use rectangle class to find the area of Square. class Rectangle { constructor(w, h) { this.w = w; this.h = h; } } // Rectangle class Method to find the area. Rectangle.prototype.area = function() { return(this.w*this.h);
Created Aug 8, 2020
View second_largest.js
 function getSecondLargest(arr) { let max = -Infinity, result = -Infinity; for (const value of arr) { const next_ele = Number(value) if (next_ele > max) { [result, max] = [max, next_ele] // save previous max } else if (next_ele < max && next_ele > result)