• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
ying_vincent
博客园    首页    新随笔    联系   管理    订阅  订阅
2014年4月9日
Data Structure Array: Sort elements by frequency
摘要: http://www.geeksforgeeks.org/sort-elements-by-frequency-set-2/ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 11 void printarray(int arr[], int n) {12 map S;13 for (int i = 0; i > T;18 for (map::iterator it = S.be... 阅读全文
posted @ 2014-04-09 12:56 ying_vincent 阅读(261) 评论(0) 推荐(0)
Data Structure Array: Maximum circular subarray sum
摘要: http://www.geeksforgeeks.org/maximum-contiguous-circular-sum/ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 11 bool allneg(int arr[], int n) {12 for (int i = 0; i 0) return false;14 }15 return true;16 }17 18 int ... 阅读全文
posted @ 2014-04-09 10:06 ying_vincent 阅读(185) 评论(0) 推荐(0)
Data Structure Array: Largest subarray with equal number of 0s and 1s
摘要: http://www.geeksforgeeks.org/largest-subarray-with-equal-number-of-0s-and-1s/ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 11 void findsubarray(int arr[], int n) {12 map > S;13 int sum = 0;14 for (int i = 0; i (1... 阅读全文
posted @ 2014-04-09 06:28 ying_vincent 阅读(409) 评论(0) 推荐(0)
Data Structure Array: Find the two numbers with odd occurrences in an unsorted array
摘要: http://www.geeksforgeeks.org/find-the-two-numbers-with-odd-occurences-in-an-unsorted-array/ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 11 void printtwoodd(int arr[], int n) {12 int x = arr[0];13 for (int i = 1; i <... 阅读全文
posted @ 2014-04-09 05:44 ying_vincent 阅读(185) 评论(0) 推荐(0)
Data Structure Array: Longest Monotonically Increasing Subsequence Size
摘要: http://www.geeksforgeeks.org/longest-monotonically-increasing-subsequence-size-n-log-n/ 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 11 int maxsum(int arr[], int n) {12 vector tail;13 tail.push_back(arr[0]);14 fo... 阅读全文
posted @ 2014-04-09 05:09 ying_vincent 阅读(258) 评论(0) 推荐(0)
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3