Skip to content

Instantly share code, notes, and snippets.

Chandan Sarkar sarkarchandan

  • Bamberg, Germany
Block or report user

Report or block sarkarchandan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sarkarchandan
sarkarchandan / Dijkstra.swift
Created Aug 21, 2017
Dijkstra Implementation
View Dijkstra.swift
import Foundation
import CoreLocation
public class Dijkstra {
public static func getShortestPath<T>(_ graph: Graph<T>, _ source: Node<T>, _ destination: Node<T>) -> [Node<T>] {
var frontier = [Path<T>]()
var possiblePaths = [Path<T>]()
var betterPath: Path<T>?
@sarkarchandan
sarkarchandan / 1 Shortened Code
Last active Jul 16, 2017
Find patching pairs of objects in an array that add up to a certain value -- Shortened
View 1 Shortened Code
// Defining an extension for implementing Binary Search in the input array where
// array elements conform to Comparable protocol
extension Array where Element: Comparable{
func binarySearch(_ value: Element) -> Int{
return binSearch(0, self.count - 1, value)
}
func binSearch(_ start: Int, _ end: Int, _ value: Element) -> Int {
if start > end {
@sarkarchandan
sarkarchandan / 1 Extension for Sort
Last active Jul 13, 2017
Find patching pairs of objects in an array that add up to a certain value
View 1 Extension for Sort
//: Playground - noun: a place where people can play
import Foundation
/**
Defining an extension for sorting the input array
where array elements conform to Comparable protocol
*/
extension Array where Element: Comparable{
mutating func quickSort() -> [Element]{
View CursorRecyclerViewAdapter.java
/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
You can’t perform that action at this time.