• ARTS第十二周


    1.Algorithm:每周至少做一个 leetcode 的算法题
    2.Review:阅读并点评至少一篇英文技术文章
    3.Tip:学习至少一个技术技巧
    4.Share:分享一篇有观点和思考的技术文章

    以下是各项的情况:

    Algorithm

    链接:[LeetCode-19]-remove-nth-node-from-end-of-list

    题意: 

    给定一个链表: 1->2->3->4->5, 和 n = 2.
    
    当删除了倒数第二个节点后,链表变为 1->2->3->5.

    分析:

    用快慢指针,快指针先移 n 个节点。

    一起移动,两指针之间一直保持 n 个节点,当快指针到链表底了,操作慢指针,删除要删除的元素

    时间复杂度:O(n)

    Review

    这周一直在跟 Josh hug 的CS61B. 感觉可以考虑讲其中一小部分 . 

    比如其中一个问题 : 数组和类什么区别   Array VS Classes


    Simply to say ,array is to think of it as a numbered sequence of memory boxes :

      1) To get ith item of array A     例如 : use A[i]

      2) Unlike class instances which have named memory boxes    

       例如 :     (假定Walrus 是一个已经写好的POJO实体类)

           int x ;                                                  −−  Gives us a memory box of  32 bits that stores ints.

           Walrus W1;                                      −−    Gives us a memory box of  64 bits that stores ints.

           Walrus w2 = new Walrus(30,5.6);         −−    Gives us a memory box of  64 bits that stores Walrus references, and also gives us 96 bits for storing the size (32 bits) and double tusksize (64 bits)                             of our walrus.

    Array :

    array consist of : 

      A  fixed integer length (cannot change)

      A sequence of N memory boxes where N=length , such that :

        1)  All of the boxes hold the same type of value (and have same # of bits)

        2) The boxes are numbered 0 through length-1.

    like instances of classes:

      You get one reference when its created.

      If you reassign all variables containing that reference , you can never get the array back

    Unlike classes , arrays do not have methods.   

    Tip

    遇到过一个问题: 死循环

    1.1.1 异常原因

     

    1.1.2 解决方法:

    一对多之类的关系的时候,不能两边都转成json格式,取消一方的转换,否则会死循环(@JSONField(serialize=false))

     

    Share

      这周暂时没看到想分享的观点。

  • 相关阅读:
    数据库备份与还原
    启明星产品与微软Active Directory活动目录集成说明
    启明星请假系统里,计算工作日的实现
    启明星会议室预定系统Outlook版开始支持Exchange2013与Office365版
    Jquery Mobile实例--利用优酷JSON接口读取视频数据
    高性能且线程安全的两种格式化日期方式
    将数列唯一值化后再求中值的效率比较 第一方案胜出,加索引后在近两百万数据中查出中值耗时0.176秒
    Oracle WITH 语句 语法
    新三种求数列中值SQL之效率再比拼
    rank,dense_rank和row_number函数区别
  • 原文地址:https://www.cnblogs.com/jxl00125/p/12734056.html
Copyright © 2020-2023  润新知