杭州Rokid团队是什么? - 机器人 - 知乎:
'via Blog this'
Blog Archive
-
▼
2017
(115)
-
▼
February
(16)
- 杭州Rokid团队是什么? - 机器人 - 知乎
- 客中守岁(在柳家庄) -- 唐代春运
- Depth First Traversal or DFS for a Graph
- Resident Alien Claiming a Treaty Exemption for a S...
- 澜声科技有限公司
- 广告配音_广告配音服务_合成配音-配音阁,国内最专业的广告配音平台
- TensorFlow极速入门 | 雷锋网
- (2) What is the best text to speech software? - Quora
- 微信摇一摇电视的技术原理是什么?有没有相类似的APP? - 支付宝 - 知乎
- Kaldi的I/O机制 | Chinese Doc of Kaldi
- algorithms/theory.md at master · skseth/algorithms
- How can I become an expert at C++ quickly? - progr...
- As a programmer, what things impress on a resume?
- Google C++ Style Guide
- 谷歌云官方:一小时掌握深度学习和TensorFlow(视频+50PPT) | 新智元 | 数据观 |...
- Passing Arrays By Reference (debug)
-
▼
February
(16)
Friday, February 24, 2017
Thursday, February 23, 2017
客中守岁(在柳家庄) -- 唐代春运
客中守岁(在柳家庄)
(评分人数不足)
朝代:唐代
作者:白居易
原文:
守岁尊无酒,思乡泪满巾。始知为客苦,不及在家贫。
畏老偏惊节,防愁预恶春。故园今夜里,应念未归人
'via Blog this'
(评分人数不足)
朝代:唐代
作者:白居易
原文:
守岁尊无酒,思乡泪满巾。始知为客苦,不及在家贫。
畏老偏惊节,防愁预恶春。故园今夜里,应念未归人
'via Blog this'
Tuesday, February 14, 2017
Depth First Traversal or DFS for a Graph
Reference:
http://www.geeksforgeeks.org/depth-first-traversal-for-a-graph/
// C++ program to print DFS traversal for a given given graph
#include<iostream>
#include<list>
#include<algorithm>
using namespace std;
class Graph
{
int V; // No. of vertices
list<int> *adj; // Pointer to an array containing adjacency lists
void DFSUtil(int v, bool visited[]); // A function used by DFS
public:
Graph(int V); // Constructor
void addEdge(int v, int w); // function to add an edge to graph
void DFS(); // prints DFS traversal of the complete graph
void DFS(int v);
};
Graph::Graph(int V)
{
this->V = V;
adj = new list<int>[V];
}
void Graph::addEdge(int v, int w)
{
adj[v].push_back(w); // Add w to v’s list.
}
void Graph::DFSUtil(int v, bool visited[])
{
// Mark the current node as visited and print it
visited[v] = true;
cout << v << " ";
// Recur for all the vertices adjacent to this vertex
list<int>::iterator i;
for(i = adj[v].begin(); i != adj[v].end(); ++i)
if(!visited[*i])
DFSUtil(*i, visited);
}
// DFS traversal of the vertices reachable from v.
// It uses recursive DFSUtil()
void Graph::DFS(int v)
{
// Mark all the vertices as not visited
bool *visited = new bool[V];
for (int i = 0; i < V; i++)
visited[i] = false;
// Call the recursive helper function to print DFS traversal
// starting from specified vertix v
DFSUtil(v, visited);
}
// The function to do DFS traversal. It uses recursive DFSUtil()
void Graph::DFS()
{
// Mark all the vertices as not visited
bool *visited = new bool[V];
for (int i = 0; i < V; i++)
visited[i] = false;
// Call the recursive helper function to print DFS traversal
// starting from all vertices one by one
for (int i = 0; i < V; i++){
std::fill_n(visited, V, false); //reset all elements to false
if (visited[i] == false){
cout<<"starting node="<<i<<":";
DFSUtil(i, visited);
}
cout<<endl;
}
}
int main()
{
// Create a graph given in the above diagram
const int V = 4;
Graph g(V);
g.addEdge(0, 1);
g.addEdge(0, 2);
g.addEdge(1, 2);
g.addEdge(2, 0);
g.addEdge(2, 3);
g.addEdge(3, 3);
cout << "\nFollowing is DFS Traversal result when tarting at node 2:\n";
g.DFS(2);
cout << "\nFollowing is DFS Traversal result when starting at each node 0~"<< V<<":\n";
g.DFS( );
return 0;
}
//Result is:
Following is DFS Traversal result when tarting at node 2:
2 0 1 3
Following is DFS Traversal result when starting at each node 0~4:
starting node=0:0 1 2 3
starting node=1:1 2 0 3
starting node=2:2 0 1 3
starting node=3:3
'via Blog this'
http://www.geeksforgeeks.org/depth-first-traversal-for-a-graph/
// C++ program to print DFS traversal for a given given graph
#include<iostream>
#include<list>
#include<algorithm>
using namespace std;
class Graph
{
int V; // No. of vertices
list<int> *adj; // Pointer to an array containing adjacency lists
void DFSUtil(int v, bool visited[]); // A function used by DFS
public:
Graph(int V); // Constructor
void addEdge(int v, int w); // function to add an edge to graph
void DFS(); // prints DFS traversal of the complete graph
void DFS(int v);
};
Graph::Graph(int V)
{
this->V = V;
adj = new list<int>[V];
}
void Graph::addEdge(int v, int w)
{
adj[v].push_back(w); // Add w to v’s list.
}
void Graph::DFSUtil(int v, bool visited[])
{
// Mark the current node as visited and print it
visited[v] = true;
cout << v << " ";
// Recur for all the vertices adjacent to this vertex
list<int>::iterator i;
for(i = adj[v].begin(); i != adj[v].end(); ++i)
if(!visited[*i])
DFSUtil(*i, visited);
}
// DFS traversal of the vertices reachable from v.
// It uses recursive DFSUtil()
void Graph::DFS(int v)
{
// Mark all the vertices as not visited
bool *visited = new bool[V];
for (int i = 0; i < V; i++)
visited[i] = false;
// Call the recursive helper function to print DFS traversal
// starting from specified vertix v
DFSUtil(v, visited);
}
// The function to do DFS traversal. It uses recursive DFSUtil()
void Graph::DFS()
{
// Mark all the vertices as not visited
bool *visited = new bool[V];
for (int i = 0; i < V; i++)
visited[i] = false;
// Call the recursive helper function to print DFS traversal
// starting from all vertices one by one
for (int i = 0; i < V; i++){
std::fill_n(visited, V, false); //reset all elements to false
if (visited[i] == false){
cout<<"starting node="<<i<<":";
DFSUtil(i, visited);
}
cout<<endl;
}
}
int main()
{
// Create a graph given in the above diagram
const int V = 4;
Graph g(V);
g.addEdge(0, 1);
g.addEdge(0, 2);
g.addEdge(1, 2);
g.addEdge(2, 0);
g.addEdge(2, 3);
g.addEdge(3, 3);
cout << "\nFollowing is DFS Traversal result when tarting at node 2:\n";
g.DFS(2);
cout << "\nFollowing is DFS Traversal result when starting at each node 0~"<< V<<":\n";
g.DFS( );
return 0;
}
//Result is:
Following is DFS Traversal result when tarting at node 2:
2 0 1 3
Following is DFS Traversal result when starting at each node 0~4:
starting node=0:0 1 2 3
starting node=1:1 2 0 3
starting node=2:2 0 1 3
starting node=3:3
'via Blog this'
Sunday, February 12, 2017
Saturday, February 11, 2017
Friday, February 10, 2017
(2) What is the best text to speech software? - Quora
(2) What is the best text to speech software? - Quora: " Best five Text to speech voices for male "
'via Blog this'
'via Blog this'
Thursday, February 9, 2017
微信摇一摇电视的技术原理是什么?有没有相类似的APP? - 支付宝 - 知乎
微信摇一摇电视的技术原理是什么?有没有相类似的APP? - 支付宝 - 知乎: "。而国内多是在18KHz以上的频率范围嵌入水印,是因为目前常用的音频频率范围为CD的不高于为22.05KHz、电视台和DVD不高于24KH"
'via Blog this'
'via Blog this'
Wednesday, February 8, 2017
Tuesday, February 7, 2017
As a programmer, what things impress on a resume?
https://www.quora.com/As-a-programmer-what-things-impress-on-a-resume/answer/Eric-Green-39
Neither a PhD, nor having worked at a big tech company have ever impressed me as a hiring manager.
First of all, with all respect to everyone I know who has done a PhD and has been exceptionally successful, I actually believe that having a PhD correlates negatively with being a good programmer. One needs to really differentiate between people who have a PhD in a field and are doing programming applied to that field vs. people who just have a PhD (including a PhD in computer science). The first can be exceptionally valuable if the field in question intersects with your business, however one should not be valuing these people for their programming skills but rather everything else they bring to the table. On the other hand, when I see that someone just did a PhD and then went on to writing code for a software shop, I really question why did they not do that right out of undergrad. Oftentimes the answers are not great.
Now, a big tech company has some real value on a resume: it’s basically a filter that tells you that this person meets some minimum technical competency. Basically they’re not going to be terrible. But that’s not really what I consider “impressing”.
Here are some things that I’ve learned to be impressed by:
- People who have built something, preferrably impactful and specific. Someone who owned a feature or a product from it’s inception all the way into production is going to catch my eye.
- Serious technical leadership. Someone who’s been a tech lead on a serious project (preferably big and impactful). Usually this also means seeing the word “architect” on a resume and some evidence that the person is not bullshitting.
- Lack of formal education or little of it. Now I don’t want to be anti-intellectual here and I’m not suggesting that simply lacking and education is a good thing. What I mean is when I receive a resume that looks strong and then I notice that the person in question went to some really mediocre school, or better yet, have no higher education, I am usually impressed. As I said above, I don’t find PhD’s impressive at all. More importantly if a candidate has a PhD that lowers the amount of information I can get from the rest of his resume. You see, if someone did a PhD and then went to Google or some other respectable place, that doesn’t tell me much because their PhD likely helped them get in. If someone went to a community college in Bumblefuck Missouri and then got hired at Google I want to talk to them ASAP.
- Cool hobbies and skills. Jobs that are not just software engineering. Look we all know you like to play board games and do Trivia Night. All of my guys (and yeah, they’re mostly guys) do. What I’ve found is that often you can bring some serious value to a software shop by hiring people who are not your typical software engineer. When those people also happen to be good software engineers you’ve really hit the jackpot.
Thursday, February 2, 2017
Wednesday, February 1, 2017
Passing Arrays By Reference (debug)
Passing Arrays By Reference - C++ Forum:
Question:
One example about passing arrays by reference in c++ was provided in:
http://www.cplusplus.com/forum/beginner/30698/
Unfortunately, it is buggy. How can you solve it?
Answer:
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
int readFile(int, int &count, int (&grades) [10]);
int writeFile(int (&grades) [10]);
int averageGrades(int, int);
/**********************************************************************
* Reads an external file of grades and then returns those values to
* other functions in the program.
*********************************************************************/
int readFile(int sum, int &count, int (&grades) [10])
{
//Declare variable
char sourceFile[16];
ifstream inStream;
//Asking for user input
cout << "Source file: ";
cin >> sourceFile;
//Open file
inStream.open(sourceFile);
if (inStream.fail())
{
cout << "Input file opening failed.\n";
exit(1);
}
//Read from file and place in array
for (int i = 0; i < 10 && inStream >> grades[i]; i++)
{
if (grades[i] == -1)
{
count++;
}
if (grades[i] != -1)
{
sum += grades[i];
}
}
return sum;
}
/**********************************************************************
* Reads an external file of grades and then returns those values to
* other functions in the program.
*********************************************************************/
int writeFile(int (&grades) [10])
{
ofstream outStream;
char destinationFile[16];
//Asking for user input
cout << "Destination file: ";
cin >> destinationFile;
//Open file
outStream.open(destinationFile);
if (outStream.fail())
{
cout << "Output file opening failed.\n";
exit(1);
}
for(auto i: grades)
outStream << i<<endl;
return 0;
}
/**********************************************************************
* Finds the average of the ten grades from the previous function.
***********************************************************************/
int averageGrades(int sum, int count, int average)
{
//The magic formula to find the average
if (count == 10)
{
cout << "Average Grade: ---%" << endl;
}
else
{
average = (sum / (10 - count));
cout << "Average Grade: " << average << "%" << endl;
}
return average;
}
/**********************************************************************
* Basically a delegator. Calls other functions to do its dirty work.
***********************************************************************/
int main()
{
//Declaring Variables
int average = 0;
int sum = 0;
int count = 0;
int grades[10];
//Calling other functions
sum = readFile(sum, count, grades);
average = averageGrades(sum, count, average);
writeFile(grades);
return 0;
}
Question:
One example about passing arrays by reference in c++ was provided in:
http://www.cplusplus.com/forum/beginner/30698/
Unfortunately, it is buggy. How can you solve it?
Answer:
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
int readFile(int, int &count, int (&grades) [10]);
int writeFile(int (&grades) [10]);
int averageGrades(int, int);
/**********************************************************************
* Reads an external file of grades and then returns those values to
* other functions in the program.
*********************************************************************/
int readFile(int sum, int &count, int (&grades) [10])
{
//Declare variable
char sourceFile[16];
ifstream inStream;
//Asking for user input
cout << "Source file: ";
cin >> sourceFile;
//Open file
inStream.open(sourceFile);
if (inStream.fail())
{
cout << "Input file opening failed.\n";
exit(1);
}
//Read from file and place in array
for (int i = 0; i < 10 && inStream >> grades[i]; i++)
{
if (grades[i] == -1)
{
count++;
}
if (grades[i] != -1)
{
sum += grades[i];
}
}
return sum;
}
/**********************************************************************
* Reads an external file of grades and then returns those values to
* other functions in the program.
*********************************************************************/
int writeFile(int (&grades) [10])
{
ofstream outStream;
char destinationFile[16];
//Asking for user input
cout << "Destination file: ";
cin >> destinationFile;
//Open file
outStream.open(destinationFile);
if (outStream.fail())
{
cout << "Output file opening failed.\n";
exit(1);
}
for(auto i: grades)
outStream << i<<endl;
return 0;
}
/**********************************************************************
* Finds the average of the ten grades from the previous function.
***********************************************************************/
int averageGrades(int sum, int count, int average)
{
//The magic formula to find the average
if (count == 10)
{
cout << "Average Grade: ---%" << endl;
}
else
{
average = (sum / (10 - count));
cout << "Average Grade: " << average << "%" << endl;
}
return average;
}
/**********************************************************************
* Basically a delegator. Calls other functions to do its dirty work.
***********************************************************************/
int main()
{
//Declaring Variables
int average = 0;
int sum = 0;
int count = 0;
int grades[10];
//Calling other functions
sum = readFile(sum, count, grades);
average = averageGrades(sum, count, average);
writeFile(grades);
return 0;
}
Subscribe to:
Posts (Atom)