Skip to content

Instantly share code, notes, and snippets.

View lifeparticle's full-sized avatar
🥥
0, 1, 2, 3…

Mahbub Zaman lifeparticle

🥥
0, 1, 2, 3…
View GitHub Profile
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) {
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) {
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;
import os
import re
import sys
import json
import tweepy
import requests
def twitter_authentication():
return tweepy.Client(
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):
public static int countOccurrences(int values[], int target) {
return upperBound(values, target) - lowerBound(values, target);
}
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;
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;
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]) {
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]) {