最佳適應算法和最壞適應算法_算法:好,壞和丑陋

最佳適應算法和最壞適應算法

by Evaristo Caraballo

通過Evaristo Caraballo

算法:好,壞和丑陋 (Algorithms: The Good, The Bad and The Ugly)

Who has been in Free Code Camp without having the experience of spending hours trying to solve Algorithms?

誰曾參加Free Code Camp,卻沒有花費大量時間嘗試求解算法

At Free Code Camp, we wanted to know why that was the case, and what more we could do to help you a bit.

在Free Code Camp,我們想知道為什么會這樣,以及我們還能做些什么來幫助您。

We made two different analyses to have a better idea of what was going on. Data were collected between Nov 2014 to Dec 2015.

我們進行了兩種不同的分析,以更好地了解正在發生的事情。 數據收集時間為2014年11月至2015年12月。

One of those analyses consisted of tracking the number of times people pasted their code to be checked by others in relevant Gitter chatrooms. We got data from the Gitter API. After some clean-up we tried to get the names of the functions of each challenge from posted messages at the Help chatroom. Although the data are not precise, it’s a good approximation of what could be happening.

這些分析之一是跟蹤人們在相關的Gitter聊天室中粘貼代碼以供其他人檢查的次數。 我們從Gitter API獲取數據。 進行一些清理后,我們嘗試從幫助聊天室中發布的消息中獲取每個挑戰的功能名稱。 盡管數據不精確,但是可以很好地近似所發生的事情。

The chart above speaks clearly on its own: algorithms like palindromes, title case, seek and destroy, longest word, reverse string, mutation or chunky monkey are those where many people ask for assistance.

上面的圖表清楚地說明了自己:回文,標題大小寫,查找和銷毀,最長的單詞,反向字符串,變異或矮胖的猴子之類的算法是許多人尋求幫助的算法。

Another analysis we made was to take the average time per page that each camper spent on each challenge, using Google Analytics data.

我們進行的另一項分析是使用Google Analytics(分析)數據獲取每個露營者在每項挑戰上花費的平均每頁時間。

Again, the ugly ones are challenges like palindromes, but there are other ones that also look ugly (let’s say 1/4 of the average time per level over the same average time) specially for basic and intermediate levels, like Spinal Tap Case, Pig Latin, Search and Replace, Common Multiple, Sum All Primes, Steamroller, Friendly Date Range, Pairwise, and others.

同樣,丑陋的挑戰是諸如回文集之類的挑戰,但是還有其他挑戰看起來也很丑陋(例如,在同一平均時間內每個級別的平均時間的1/4), 特別是對于基礎水平和中級水平而言 ,例如Spinal Tap Case,Pig拉丁語,搜索和替換,公倍數,所有素數之和,Steamroller,友好日期范圍,成對和其他。

Looking at the results, can we suggest the factors that are affecting the performance of campers with the algorithms?

從結果來看我們能否通過算法提出影響露營者性能的因素

The most apparent reasons, given in a tentative ordering, are:

按暫定順序給出的最明顯的原因是:

  • Campers are finding hard to deal specially with strings, and Regex is a bad word, no matter the level!

    營員發現很難對付 ,而正則表達式無論級別高低都是一個壞詞!

  • There are some numeric challenges that are making camper’s life difficult, particularly those which are suitable for recursive calls.

    有一些數字難題使露營者的生活變得困難,尤其是那些適合遞歸調用的難題。

  • Another common problem is dealing with nested collections of arrays/objects.

    另一個常見的問題是處理數組/對象的嵌套集合

  • Difficulty with concepts and definitions is usual. For example, the concept of “symmetric difference” (with a Free Code Camp algorithm with the same name) is usually troubling because many campers don’t understand the concept properly, despite the inclusion of a widely accepted mathematical definition.

    通常很難理解概念和定義 。 例如,“對稱差異”的概念(使用具有相同名稱的Free Code Camp算法)通常令人不安,因為盡管包含了廣泛接受的數學定義,但許多營員仍無法正確理解該概念。

Similarly, looking at the last chart you may be wondering why the time per page seems not to reflect the difficulty of the problem? One explanation could be that the basic and intermediate algorithms are been taken by campers who are just learning to code or seeing JavaScript for the first time. However this is a tentative explanation and may require more analyses.

同樣,查看最后一個圖表,您可能想知道為什么每頁時間似乎不能反映問題的難度 ? 一種解釋可能是,基本算法和中間算法是由剛開始學習編碼或第一次看到JavaScript的營員采用的。 但是,這只是一個初步的解釋,可能需要更多的分析。

If you are reading this and you have already suffered with some of the algorithms, you will realize that you are not alone. For those who are starting with algorithms, I would recommend the following:

如果您正在閱讀本文,并且已經受了某些算法的困擾,您將意識到自己并不孤單。 對于那些開始使用算法的人,我建議以下內容:

  • Try to see if you can solve the easiest first: you might find some practice solving those that could help you to deal with the more difficult ones later…

    嘗試先看看是否可以解決最簡單的問題:您可能會找到一些解決方法,可以幫助以后解決更困難的問題……
  • Try to understand the problem! Start by asking what the problem is about.

    嘗試了解問題! 首先詢問問題所在。
  • Research. Check b0oks, references, and other online courses. And Share. We are offering a lot of help with likely a similar problem like yours. Ask in the chatroom. Send a message to CamperBot. Look at the Wiki. Try pair programming. Visit a Campsite and code with other campers in person. In one of the CodePens I made for this article, I also included links to the Free Code Camp wiki, so you can have a first overview of the problem and how it is normally solved.

    研究。 檢查書,參考書和其他在線課程。 和分享。 對于像您這樣的類似問題,我們提供了很多幫助。 在聊天室提問。 發信息給CamperBot。 看一下Wiki。 嘗試配對編程。 參觀營地并親自與其他營員進行編碼。 在我為本文編寫的CodePens之一中,我還提供了指向Free Code Camp Wiki的鏈接,因此您可以初步了解該問題以及通常如何解決該問題。
  • You may already know that the problem is difficult: now the next step is trying to understand why and what make it so hard. This approach is key for algorithmic problem solving, and programming in general. Study, ask, and try again.

    您可能已經知道問題很棘手:現在,下一步就是嘗試了解導致問題變得如此困難的原因原因 。 這種方法對于解決算法問題和一般編程至關重要。 研究,詢問,然后重試。

  • The data we used for these analyses were for last year: this year SaintPeter and friends have been working hard in modify the curriculum, so you may notice a difference in your performance if you work through the improved Basic JavaScript section. If you haven’t done the updated curriculum it may be helpful to revisit that section.

    我們用于這些分析的數據是去年的:今年, 圣彼得和朋友們一直在努力修改課程表,因此,如果您在改進的“基本JavaScript”部分中工作,您可能會發現性能有所不同。 如果您還沒有完成更新的課程表,那么重新訪問該部分可能會有所幫助。

  • My bonus advice? Yes, try really hard yourself but… read other peoples’ code, too. When you read a book about JavaScript to learn programming, that is exactly what you are doing. Learn to reverse engineer existing code and to modify it to suit your needs. Why? First, no point in re-inventing the wheel. Second, you learn a lot by understanding the work of those who already solved the problem. Remember: you will find that most of the time you will be reusing modified snippets of a previous code into a new one. So no shame in reading other’s codes. That is part of the nature of Open Source, by the way…

    我的獎金建議? 是的,你要自己努力,但是……也要閱讀其他人的代碼。 當您閱讀有關JavaScript的書以學習編程時,這就是您正在做的事情。 學習對現有代碼進行反向工程并進行修改以滿足您的需求。 為什么? 首先,重新發明輪子毫無意義。 其次,通過了解已經解決問題的人員的工作,您學到了很多東西。 請記住:您會發現大多數時候您將把先前代碼的修改片段重用到新代碼中。 因此,在閱讀他人的代碼時不會感到羞恥。 順便說一下,這是開放源代碼本質的一部分。

Happy Coding!

編碼愉快!

I’m also working on related visualizations at bl.ocks.org/evaristoc.

我還在bl.ocks.org/evaristoc上進行相關的可視化工作。

This analysis just scratches the surface of what we can learn from Free Code Camp’s open data. Join our Data Science chat room and help us make sense of all these data.

這種分析只是從表面上我們可以從Free Code Camp的開放數據中學到什么。 加入我們的數據科學聊天室 ,幫助我們理解所有這些數據。

翻譯自: https://www.freecodecamp.org/news/algorithms-the-good-the-bad-and-the-ugly-e63db0a9cfb3/

最佳適應算法和最壞適應算法

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/396406.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/396406.shtml
英文地址,請注明出處:http://en.pswp.cn/news/396406.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

mysql條件觸發器實例_mysql觸發器實例一則

例子,實例學習mysql觸發器的用法。一,準備二張測試表:1,測試表1復制代碼 代碼示例:DROP TABLE IF EXISTS test;CREATE TABLE test (id bigint(11) unsigned NOT NULL AUTO_INCREMENT,name varchar(100) NOT NUL…

阿里大數據神預測 勝率僅5.9%中國卻1:0勝韓國

寫在最前面:這是早晨偶然看到的一篇文章,是對昨天中國卻1:0勝韓國的評論。有朋友感慨:努力不放棄的時候,全世界都會幫你。這篇內容很全面的串起阿里巴巴在大數據預測方面的動作,角度很別致,分享…

Python中類、對象與self詳解

先介紹一下python中的類與對象/實例。然后詳細說明self。說明:對象等同實例,本文稱呼不一致時請自行統一 【一】類與對象/實例 1、類 (1)類由名稱、屬性、方法三部分組成 (2)類是抽象模板,比如學…

面試題28 字符串排列

題目描述 輸入一個字符串,按字典序打印出該字符串中字符的所有排列。例如輸入字符串abc,則打印出由字符a,b,c所能排列出來的所有字符串abc,acb,bac,bca,cab和cba。 結果請按字母順序輸出。 輸入描述: 輸入一個字符串,長度不超過9(可能有字符重復),字符只包括大小寫字母。 1 cla…

javascript 框架_克服JavaScript框架疲勞

javascript 框架by Tero Parviainen通過Tero Parviainen 克服JavaScript框架疲勞 (Overcoming JavaScript Framework Fatigue) The JavaScript community is suffering from a wave of framework fatigue. It’s caused by the massive outpouring of new frameworks, techniq…

java開發環境:還在配classpath?你out啦!

2019獨角獸企業重金招聘Python工程師標準>>> 先說結論:只需要配置JAVA_HOME和path路徑即可,無需配置classpath 參考Oracle官網的說明: The class path tells JDK tools and applications where to find third-party and user-defi…

qpython3可以調用哪些庫_Python3 如何使用asyncio庫在調用第三方模塊(存在IO等待)的情況下實現協程?...

問題描述demo中有一個 task_check 的模塊,底層是用urllib實現,請問如果要實現使用 asyncio 庫實現協程操作,需要修改這個模塊的底層代碼嗎?如何修改? 往大佬指點問題出現的環境背景及自己嘗試過哪些方法平時都是使用 gevent 庫和 monkey.patch_all() 實現協程,但發現 gevent …

.Net Core 商城微服務項目系列(二):使用Ocelot + Consul構建具備服務注冊和發現功能的網關...

1.服務注冊 在上一篇的鑒權和登錄服務中分別通過NuGet引用Consul這個包,同時新增AppBuilderExtensions類: public static class AppBuilderExtensions{public static IApplicationBuilder RegisterConsul(this IApplicationBuilder app,IApplicationLife…

java打印數組_Java中打印數組內容的方式有哪些?

下面是幾種常見的打印方式。方法一:使用循環打印。public class Demo {public static void main(String[] args) {String[] infos new String[] {"Java", "Android", "C/C", "Kotlin"};StringBuffer strBuffer new Strin…

$(function() {})

$(function() {});是$(document).ready(function(){ })的簡寫, 最早接觸的時候也說$(document).ready(function(){ })這個函數是用來取代頁面中的window.onload; 用來在DOM加載完成之后執行一系列預先定義好的函數。

恢復工具

EasyRecovery http://www.upantool.com/hfxf/huifu/2011/EasyRecovery_V6.22.html轉載于:https://www.cnblogs.com/cb168/p/5359133.html

四參數坐標轉換c++_GPSRTK坐標轉換及四參數、七參數適用條件

工程測量儀器已由經緯儀、全站儀過渡到GNSS(全球衛星導航系統),特別是公路行業,GPS-RTK作為GNSS的一種應用目前已十分普及。現階段GPS-RTK以WGS-84 坐標系統為主流,所發布的星歷參數也是基于此坐標系統,但隨著北斗導航系統的逐步完…

教主的魔法

傳送門 這道題序列很長,但是操作數很少,然后也沒想到什么好的數據結構來維護,那就分塊吧。 感覺維護的過程很好想,修改的時候對于整個塊都在內的直接打標記,兩個零散的區間暴力重構,重新排序。查詢的時候&a…

obs自定義編碼設置_通過7個步驟設置OBS進行實時編碼

obs自定義編碼設置by Wesley McCann韋斯利麥肯(Wesley McCann) 通過7個步驟設置OBS進行實時編碼 (Setting up OBS for Live Coding in 7 Steps) Twitch TV is a popular live-streaming service. You traditionally used Twitch to stream yourself playing video games, but …

java hadoop api_Hadoop 系列HDFS的Java API( Java API介紹)

HDFS的Java APIJava API介紹將詳細介紹HDFS Java API,一下節再演示更多應用。Java API 官網如上圖所示,Java API頁面分為了三部分,左上角是包(Packages)窗口,左下角是所有類(All Classes是)窗口,右側是詳情窗口。這里推…

最大連通子數組

這次是求聯通子數組的求和,我們想用圖的某些算法,比如迪杰斯特拉等,但是遇到了困難。用BFS搜索能達到要求,但是還未能成功。 那么我們這樣想,先將每行的最大子數組之和,然后再將這些最大之和組成一個數組&a…

redis的zset的底層實現_Redis(三)--- Redis的五大數據類型的底層實現

1、簡介Redis的五大數據類型也稱五大數據對象;前面介紹過6大數據結構,Redis并沒有直接使用這些結構來實現鍵值對數據庫,而是使用這些結構構建了一個對象系統redisObject;這個對象系統包含了五大數據對象,字符串對象(st…

科學計算機簡單編程_是“計算機科學”還是“編程”?

科學計算機簡單編程by Sam Corcos由Sam Corcos 是“計算機科學”還是“編程”? (Is It “Computer Science” or “Programming”?) 教育政策白皮書(提示:它們不是同一個東西) (An education policy white paper (hint: they’re not the same thing))…

[Matlab] 畫圖命令

matlab畫圖命令,不定時更新以便查找 set(gcf, color, [1 1 1]);     % 使圖背景為白色 alpha(0.4);           %設置平面透明度 plot(Circle1,Circle2,k--,linewidth,1.25);  % k--設置線型  ‘linewidth’,1.25  設置線寬度為1.25 %線型   …

django入門記錄 2

1. 創建一個app, python manage.py startapp appname 2. 設計model,在appname/目錄下編輯好model 3. 檢測model的修改,python manage.py makemigrations appname 4. 自動執行數據庫遷移,并同步管理數據庫結構, python…