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
import java.util.ArrayList; | |
import java.util.List; | |
public class Main { | |
public static void main(String[] args) { | |
if (args.length == 0) { | |
System.out | |
.println("Proper Usage is: java main number1 number2 number3 ..."); | |
System.exit(0); | |
} |
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
import java.util.LinkedList; | |
import java.util.Queue; | |
public class AVLTree<T extends Comparable<T>> { | |
Node<T> root; | |
public AVLTree() { | |
root = null; | |
} |
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
/** | |
* This is a demo class in java <br /> | |
* Implementing Binary Tree Traverse Level By Level with BFS and DFS. <br /> | |
* All of the algorithm I implemented use O(N) time and space, N here represents the number of nodes in the tree. | |
* | |
*/ | |
import java.util.LinkedList; | |
import java.util.Queue; | |
/** |
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)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
UISwipeGestureRecognizer *leftGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipe:)]; | |
leftGesture.direction = UISwipeGestureRecognizerDirectionDown; | |
[self.tableView addGestureRecognizer:leftGesture]; | |
UISwipeGestureRecognizer *rightGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipe:)]; | |
rightGesture.direction = UISwipeGestureRecognizerDirectionUp; |
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
- (BOOL)getBitforNumber:(NSInteger)num atIndex:(NSUInteger)i | |
{ | |
return (num & (1 << i)) != 0; | |
} | |
- (NSInteger)setBitforNumber:(NSInteger)num atIndex:(NSUInteger)i | |
{ | |
return num | (1 << 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
- (NSArray *)quicksort:(NSArray *)array |
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
/** | |
* Divide and Conque Algorithm. | |
*/ | |
- (NSArray *)mergesort:(NSArray *)array |
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
/** | |
* Standard Binary Search. | |
*/ | |
- (BOOL)binarySearch:(NSInteger)number inArray:(NSArray *)array; | |
/** | |
* Find the very first element index in an ordered array that satisfy with crateria, then return the index. | |
* Otherwise, return -1. | |
* This algorithm implemented with binary search. | |
*/ |
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
/** | |
* TreeNode: | |
* -val: NSNumber | |
* -left: TreeNode | |
* -right: TreeNode | |
*/ | |
// Task: Build a Balanced Binary Search Tree from an Ordered Array. | |
- (TreeNode *)buildMinBSTFromArray:(NSArray *)array; |
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
// | |
// ViewController.m | |
// | |
// Created by Antonio081014 on 6/4/16. | |
// Copyright © 2016 Antonio081014.com. All rights reserved. | |
// | |
#import "ViewController.h" | |
@import FBAudienceNetwork; |
OlderNewer