This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int binarySearch(L,left,right,x){ | |
if(left>right){ | |
return -1; | |
} | |
int mid=(left+right)~/2; | |
if(L[mid]==x){ | |
return mid; | |
} | |
if(L[mid]<x){ | |
return binarySearch(L,mid+1,right,x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void insertionSort_asc(var L){ | |
int n=L.length; | |
for(var i=1;i<n;i++){ | |
var item=L[i]; | |
var j=i-1; | |
while(j>=0 && L[j]>item){ | |
L[j+1]=L[j]; | |
j=j-1; | |
L[j+1]=item; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void bubbleSort(var L) { | |
var n = L.length; | |
for (var i = 0; i < n; i++) { | |
for (var j = 0; j < n - i - 1; j++) { | |
if (L[j] > L[j + 1]) { | |
var temp = L[j]; | |
L[j] = L[j + 1]; | |
L[j + 1] = temp; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void selectionSort(var L) { | |
var n = L.length; | |
for (var i = 0; i < n - 1; i++) { | |
var index_min = i; | |
for (var j = i + 1; j < n; j++) { | |
if (L[j] < L[index_min]) { | |
index_min = j; | |
} | |
} | |
if (index_min != i) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Stack { | |
List items; | |
Stack(this.items); | |
@override | |
String toString() => 'List :$items'; | |
void push(int item) { | |
this.items.add(item); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int left(int i) { | |
return 2 * i; | |
} | |
int right(int i) { | |
return 2 * i - 1; | |
} | |
int parant(int i) { | |
return i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def addition_function | |
puts "Which numbers would you like to add?" | |
@n1 = gets.chomp | |
@n2 = gets.chomp | |
@answer = @n1 + @n2 | |
# @n1 + @n2 == @answer | |
puts "The sum is... #{@answer}" | |
end | |
def subtraction_function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace DCP_8_Get_the_Numbers | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int T=int.Parse(Console.ReadLine()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE NETSCAPE-Bookmark-file-1> | |
<!-- This is an automatically generated file. | |
It will be read and overwritten. | |
DO NOT EDIT! --> | |
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> | |
<TITLE>Bookmarks</TITLE> | |
<H1>Bookmarks</H1> | |
<DL><p> | |
<DT><H3 ADD_DATE="1626629115" LAST_MODIFIED="1626629462" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3> | |
<DL><p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done | |
git fetch --all | |
git pull --all |
OlderNewer