Vulkan

04 2014 档案

Cracking The Coding Interview 9.7
摘要://原文://// A circus is designing a tower routine consisting of people standing atop one another’s shoulders. For practical and aesthetic reasons, each ... 阅读全文

posted @ 2014-04-28 23:23 Vulkan 阅读(126) 评论(0) 推荐(0)

Cracking The Coding Interview 9.6
摘要://原文://// Given a matrix in which each row and each column is sorted, write a method to find an element in it.// 从最右一排,从上到下,小于右上角的元素则下降,大于右上角的元素则左移找;... 阅读全文

posted @ 2014-04-28 22:00 Vulkan 阅读(101) 评论(0) 推荐(0)

Cracking The Coding Interview 9.6
摘要://原文://// Given a sorted array of strings which is interspersed with empty strings, write a method to find the location of a given string.////Example:... 阅读全文

posted @ 2014-04-28 11:13 Vulkan 阅读(149) 评论(0) 推荐(0)

Cracking The Coding Interview 9.3
摘要://Given a sorted array of n integers that has been rotated an unknown number of times, give an O(log n) algorithm that finds an element in the array. ... 阅读全文

posted @ 2014-04-28 10:45 Vulkan 阅读(129) 评论(0) 推荐(0)

Cracking The Coding Interview
摘要://原文://// Write a method to sort an array of strings so that all the anagrams are next to each other.// 译文:// 写一个函数对字符串数组排序,使得所有的变位词都相邻。//参考@hawstein#... 阅读全文

posted @ 2014-04-23 14:40 Vulkan 阅读(159) 评论(0) 推荐(0)

Cracking The Coding Interview 9.1
摘要://原文://// You are given two sorted arrays, A and B, and A has a large enough buffer at the end to hold B. Write a method to merge B into A in sorted o... 阅读全文

posted @ 2014-04-23 13:50 Vulkan 阅读(91) 评论(0) 推荐(0)

Cracking The Coding Interview 9.0
摘要:#include #include using namespace std;void mswap(int &a, int &b){ int c = a; a = b; b = c;}void print(int *a, int size){ for (int i = 0; i a[i+1]) {... 阅读全文

posted @ 2014-04-23 13:24 Vulkan 阅读(140) 评论(0) 推荐(0)

Cracking The Coding Interview 5.7
摘要://An array A[1…n] contains all the integers from 0 to n except for one number which is missing. In this problem, //we cannot access an entire integer ... 阅读全文

posted @ 2014-04-18 14:30 Vulkan 阅读(140) 评论(0) 推荐(0)

Cracking The Coding Interview 5.6
摘要://Write a program to swap odd and even bits in an integer with as few instructions as possible (e.g., bit 0 and bit 1 are swapped, bit 2 and bit 3 are... 阅读全文

posted @ 2014-04-18 12:59 Vulkan 阅读(156) 评论(0) 推荐(0)

Cracking The Coding Interview 5.5
摘要:#include #include using namespace std;int getNum1(int N){ int num=0; for (int i=0; i>1; } return num;}void print(int p) { vector v; for (int k = 0;k>... 阅读全文

posted @ 2014-04-18 12:12 Vulkan 阅读(116) 评论(0) 推荐(0)

Cracking The Coding Interview5.3 暂存
摘要:的 阅读全文

posted @ 2014-04-18 12:12 Vulkan 阅读(91) 评论(0) 推荐(0)

Cracking The Coding Interview5.2
摘要://Given a (decimal - e.g. 3.72) number that is passed in as a string, print the binary representation.If the number can not be represented accurately ... 阅读全文

posted @ 2014-04-18 01:48 Vulkan 阅读(96) 评论(0) 推荐(0)

Cracking The Coding Interview5.1
摘要://You are given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e.g., M b... 阅读全文

posted @ 2014-04-18 01:17 Vulkan 阅读(156) 评论(0) 推荐(0)

Cracking The Coding Interview4.8
摘要://You are given a binary tree in which each node contains a value. Design an algorithm to print all paths which sum up to that value. Note that it can... 阅读全文

posted @ 2014-04-17 22:27 Vulkan 阅读(138) 评论(0) 推荐(0)

Cracking The Coding Interview 4.7_暂存
摘要://原文://// You have two very large binary trees: T1, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a s... 阅读全文

posted @ 2014-04-17 15:06 Vulkan 阅读(135) 评论(0) 推荐(0)

Cracking The Coding Interview 4.6
摘要://原文://// Design an algorithm and write code to find the first common ancestor of two nodes in a binary tree. Avoid storing additional nodes in a data... 阅读全文

posted @ 2014-04-17 14:15 Vulkan 阅读(134) 评论(0) 推荐(0)

Cracking The Coding Interview4.5
摘要://原文://// Write an algorithm to find the ‘next’ node (i.e., in-order successor) of a given node in a binary search tree where each node has a link to ... 阅读全文

posted @ 2014-04-16 14:54 Vulkan 阅读(107) 评论(0) 推荐(0)

Cracking The Coding Interview 4.4
摘要://Given a binary search tree, design an algorithm which creates a linked list of all the nodes at each depth (i.e., if you have a tree with depth D, y... 阅读全文

posted @ 2014-04-16 11:56 Vulkan 阅读(128) 评论(0) 推荐(0)

Cracking The Coding Interview4.3
摘要://Given a sorted (increasing order) array, write an algorithm to create a binary tree with minimal height.//// 译文://// 给定一个有序数组(递增),写程序构建一棵具有最小高度的二叉树。... 阅读全文

posted @ 2014-04-15 20:38 Vulkan 阅读(190) 评论(0) 推荐(0)

Cracking The Coding Interview 4.2_暂存
摘要:X 阅读全文

posted @ 2014-04-15 15:58 Vulkan 阅读(88) 评论(0) 推荐(0)

Cracking The Coding Interview 4.1
摘要://Implement a function to check if a tree is balanced. For the purposes of this question, a balanced tree is defined to be a tree such that no two lea... 阅读全文

posted @ 2014-04-15 15:54 Vulkan 阅读(150) 评论(0) 推荐(0)

Cracking The Coding Interview 4.0_二叉树
摘要:#include #include using namespace std;class tree{public: tree() { //root = create(); root = NULL; } /***输入扩展层次遍历序列,#表示该节点为空***/ tree(char *s) { roo... 阅读全文

posted @ 2014-04-15 14:45 Vulkan 阅读(157) 评论(0) 推荐(0)

[转]如何远程连接运行OpenGL/Cuda 等GPU程序
摘要:发现一篇神文,解决了困扰许久的远程桌面OpenGL/GPU 等问题。。。原地址在这:http://www.tanglei.name/how-to-run-gpu-programs-using-remote-connection/有时候往往需要通过远程桌面连接进行coding工作,像一般的比如web之... 阅读全文

posted @ 2014-04-11 12:13 Vulkan 阅读(1806) 评论(0) 推荐(0)

Cracking The Coding Interview 3.6
摘要:// Write a program to sort a stack in ascending order. You should not make any assumptions about how the stack is implemented. The following are the o... 阅读全文

posted @ 2014-04-11 09:57 Vulkan 阅读(139) 评论(0) 推荐(0)

Cracking The Coding Interview 3.5
摘要://Implement a MyQueue class which implements a queue using two stacks.#include #includeusing namespace std;class MyQueue{public: stack data,buffer; My... 阅读全文

posted @ 2014-04-11 09:54 Vulkan 阅读(188) 评论(0) 推荐(0)

Cracking The Coding Interview3.4 暂存
摘要:暂存 阅读全文

posted @ 2014-04-11 09:52 Vulkan 阅读(87) 评论(0) 推荐(0)

Cracking The Coding Interview3.3
摘要://Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when th... 阅读全文

posted @ 2014-04-10 15:17 Vulkan 阅读(142) 评论(0) 推荐(0)

Cracking The Coding Interview 3.2
摘要://How would you design a stack which, in addition to push and pop, also has a function min which returns the minimum element? Push, pop and min should... 阅读全文

posted @ 2014-04-10 11:39 Vulkan 阅读(183) 评论(0) 推荐(0)

Cracking The Coding Interview 2.5
摘要:这题的思想来自于http://hawstein.com/posts/2.5.html,重新实现了一下用hash来记录循环的起点//Given a circular linked list, implement an algorithm which returns node at the beginn... 阅读全文

posted @ 2014-04-09 13:33 Vulkan 阅读(124) 评论(0) 推荐(0)

Cracking The Coding Interview2.4
摘要:删除前面的linklist,使用node来表示链表// You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in rever... 阅读全文

posted @ 2014-04-09 13:31 Vulkan 阅读(176) 评论(0) 推荐(0)

Cracking The Coding Interview2.3
摘要:#include #include using namespace std;class linklist{private: class node { public: node(){} string data; node * next; }; int size;public: node *he... 阅读全文

posted @ 2014-04-08 22:09 Vulkan 阅读(142) 评论(0) 推荐(0)

Cracking The Coding Interview 2.2
摘要:#include #include using namespace std;class linklist{private: class node { public: node(){} string data; node * next; }; node *head; int size;publi... 阅读全文

posted @ 2014-04-08 21:24 Vulkan 阅读(120) 评论(0) 推荐(0)

Cracking The Coding Interview2.1 暂存
摘要:暂存 阅读全文

posted @ 2014-04-08 21:23 Vulkan 阅读(100) 评论(0) 推荐(0)

Cracking The Coding Interview 2.0 单链表
摘要:#include #include using namespace std;class linklist{private: class node { public: node(){} string data; node * next; }; node *first; int size;publ... 阅读全文

posted @ 2014-04-08 11:10 Vulkan 阅读(72) 评论(0) 推荐(0)

Cracking The Coding Interview 1.8
摘要://Assume you have a method isSubstring which checks if one word is a substring of another. //Given two strings, s1 and s2, write code to check if s2 i... 阅读全文

posted @ 2014-04-03 12:25 Vulkan 阅读(135) 评论(0) 推荐(0)

Cracking The Coding Interview 1.7
摘要://Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0.////这题原答案就是要两个buffer来记录出现0的位置。不知道有没可以不用buffe... 阅读全文

posted @ 2014-04-03 10:39 Vulkan 阅读(109) 评论(0) 推荐(0)

Cracking The Coding Interview 1.6
摘要://原文://// Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can... 阅读全文

posted @ 2014-04-03 09:45 Vulkan 阅读(151) 评论(0) 推荐(0)

Cracking The Coding Interview 1.5
摘要://原文://// Write a method to replace all spaces in a string with ‘%20’.//#include using namespace std;char* replace(char * str){ if (str == NULL) { re... 阅读全文

posted @ 2014-04-02 15:52 Vulkan 阅读(126) 评论(0) 推荐(0)

Cracking The Coding Interview 1.4
摘要://Write a method to decide if two strings are anagrams or not.//// 变位词(anagrams)指的是组成两个单词的字符相同,但位置不同的单词。比如说, abbcd和abcdb就是一对变位词。// // 使用一个固定数组大小记录各个... 阅读全文

posted @ 2014-04-01 16:47 Vulkan 阅读(115) 评论(0) 推荐(0)

Cracking The Coding Interview 1.3
摘要://原文://// Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer. NOTE: One or two addi... 阅读全文

posted @ 2014-04-01 16:28 Vulkan 阅读(107) 评论(0) 推荐(0)

导航