This file contains hidden or 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
public class Main { | |
public static void main (String args[]) { | |
selectionSort(new int [] {1, 4, 7, 10, 2}); | |
} | |
public static void selectionSort(int[] arr) { | |
int tmp, minIndex; | |
for (int i = 0; i < arr.length - 1; ++i) { | |
minIndex = i; | |
for (int j = i + 1; j < arr.length; ++j) { |
This file contains hidden or 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
public class Main { | |
public static void main (String args[]) { | |
bubbleSort(new int [] {1, 4, 7, 10, 2}); | |
} | |
public static void bubbleSort(int[] arr) { | |
int i, j; | |
int tmp = 0; | |
for (i = 0; i < arr.length; ++i) { | |
for (j = 0; j < arr.length - 1; ++j) { |
This file contains hidden or 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
public class Main { | |
public static void main (String args[]) { | |
bubbleSort(new int [] {1, 4, 7, 10, 2}); | |
} | |
public static void bubbleSort(int[] arr) { | |
boolean isSorted = false; | |
int j = 1, i; | |
int tmp; |
This file contains hidden or 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
import os | |
import re | |
import sys | |
import json | |
import tweepy | |
import requests | |
def twitter_authentication(): | |
return tweepy.Client( |
This file contains hidden or 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
from PIL import Image | |
import pytesseract | |
def process_image(iamge_name, lang_code): | |
return pytesseract.image_to_string(Image.open(iamge_name), lang=lang_code) | |
def print_data(data): | |
print(data) | |
def output_file(filename, data): |
This file contains hidden or 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
public static int countOccurrences(int values[], int target) { | |
return upperBound(values, target) - lowerBound(values, target); | |
} |
This file contains hidden or 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
public static int lowerBound (int values[], int target) { | |
int left = 0; | |
int right = values.length - 1; | |
int mid; | |
if (values[right] < target) | |
return values.length; | |
while (right > left){ | |
mid = (left + right) / 2; |
This file contains hidden or 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
public static int upperBound (int values[], int target) { | |
int left = 0; | |
int right = values.length - 1; | |
int mid; | |
if (values[right] <= target) | |
return values.length; | |
while (right > left){ | |
mid = (left + right) / 2; |
This file contains hidden or 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
public static int lastOccurrence (int values[], int target) { | |
int left = 0; | |
int mid = 0; | |
int right = values.length - 1; | |
int pos = -1; | |
while (left <= right) { | |
mid = (left + right) / 2; | |
if (target == values[mid]) { |
This file contains hidden or 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
public static int firstOccurrence (int values[], int target) { | |
int left = 0; | |
int mid = 0; | |
int right = values.length - 1; | |
int pos = -1; | |
while (left <= right) { | |
mid = (left + right) / 2; | |
if (target == values[mid]) { |